New GitHub issue #119572 from TKirchmeier:<br>

<hr>

<pre>
# Bug report

### Bug description:

I don't know, if this is a bug, but I cannot find any reasons for the following behaviour. From my understanding the `audit` function should be called when the Test object is created. This isn't the case for Python3.12 and 3.11, but you get the output-print with Jupyter Notebooks (pyodide, [jupyter.org](https://jupyter.org/try-jupyter/notebooks/?path=notebooks/Intro.ipynb)). But why?

```python
import sys

def audit(event, args):
    output = f'{event} with args={args}'
 print(output)

sys.addaudithook(audit)

class Test: 
    def __init__(self):
        pass

a = Test()
```

If you copy the code in a Jupyter Notebook you get the following result:
```
compile with args=(<ast.Module object at 0x1601da8>, None)
exec with args=(<code object <module> at 0x17e29b0, file "<ipython-input-1-51b4222a1940>", line 1>,)
compile with args=(<ast.Module object at 0x25d4910>, None)
exec with args=(<code object <module> at 0x17e2c00, file "<ipython-input-1-51b4222a1940>", line 1>,)
inti Test
```

### CPython versions tested on:

3.11, 3.12

### Operating systems tested on:

macOS, Other
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/119572">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>