HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/IPython/core/tests/tclass.py
"""Simple script to be run *twice*, to check reference counting bugs.

See test_run for details."""


import sys

# We want to ensure that while objects remain available for immediate access,
# objects from *previous* runs of the same script get collected, to avoid
# accumulating massive amounts of old references.
class C(object):
    def __init__(self,name):
        self.name = name
        self.p = print
        self.flush_stdout = sys.stdout.flush
        
    def __del__(self):
        self.p('tclass.py: deleting object:',self.name)
        self.flush_stdout()

try:
    name = sys.argv[1]
except IndexError:
    pass
else:
    if name.startswith('C'):
        c = C(name)

# print("ARGV:", sys.argv, file=sys.stderr)  # dbg

# This next print statement is NOT debugging, we're making the check on a
# completely separate process so we verify by capturing stdout:
print('ARGV 1-:', sys.argv[1:])
sys.stdout.flush()