[Python-Dev] Unexpected increase of globals() refcount

2014-05-23 Thread Chandra Srinivasan
Hi,
I ran the following code in the Python interpreter and am trying to determine 
if the behavior I see is expected:

import sys
print sys.getrefcount(globals())
class Foo(object):
   def __init__(self):
  pass
print sys.getrefcount(globals())

The first print statement above prints '4' and the second one prints '5'. 
However, if I remove the __init__ method from the class, the refcount stays the 
same.

If I change the above code like this, the ref count stays the same:

import gc
import sys
print sys.getrefcount(globals())
class Foo(object):
   def __init__(self):
  pass
del Foo
while gc.collect():
  pass
print sys.getrefcount(globals())

Can you let me know if this is a bug in the Python interpreter?

-Chandra
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Unexpected increase of globals() refcount

2014-05-23 Thread Benjamin Peterson
On Fri, May 23, 2014, at 8:49, Chandra Srinivasan wrote:
> Hi,
> I ran the following code in the Python interpreter and am trying to
> determine if the behavior I see is expected:
> 
> import sys
> print sys.getrefcount(globals())
> class Foo(object):
>def __init__(self):
>   pass
> print sys.getrefcount(globals())
> 
> The first print statement above prints '4' and the second one prints '5'.
> However, if I remove the __init__ method from the class, the refcount
> stays the same.
> 
> If I change the above code like this, the ref count stays the same:
> 
> import gc
> import sys
> print sys.getrefcount(globals())
> class Foo(object):
>def __init__(self):
>   pass
> del Foo
> while gc.collect():
>   pass
> print sys.getrefcount(globals())
> 
> Can you let me know if this is a bug in the Python interpreter?

No, functions hold a reference to the globals of the module they are
defined in.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Summary of Python tracker Issues

2014-05-23 Thread Python tracker

ACTIVITY SUMMARY (2014-05-16 - 2014-05-23)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open4622 ( +8)
  closed 28710 (+36)
  total  2 (+44)

Open issues with patches: 2129 


Issues opened (26)
==

#21518: Expose RegUnloadKey in winreg
http://bugs.python.org/issue21518  opened by Claudiu.Popa

#21519: IDLE : Bug in keybinding validity check
http://bugs.python.org/issue21519  opened by sahutd

#21520: Erroneous zipfile test failure if the string 'bad' appears in 
http://bugs.python.org/issue21520  opened by larry

#21521: Tkinter + OSX + Spaces : Multiple file dialogues created
http://bugs.python.org/issue21521  opened by rovf

#21524: Allowing to pass pathlib.Path object in mimetypes.guess_type f
http://bugs.python.org/issue21524  opened by jorispilot

#21526: Support new booleans in Tkinter
http://bugs.python.org/issue21526  opened by serhiy.storchaka

#21527: concurrent.futures.ThreadPoolExecutor does not use a default v
http://bugs.python.org/issue21527  opened by Claudiu.Popa

#21531: Sending a zero-length UDP packet to asyncore invokes handle_cl
http://bugs.python.org/issue21531  opened by Tony.Gedge

#21532: 2.7.7rc1 msi is lacking libpython27.a
http://bugs.python.org/issue21532  opened by loewis

#21533: built-in types dict docs - construct dict from iterable, not i
http://bugs.python.org/issue21533  opened by wolma

#21534: 404 on documentation download links
http://bugs.python.org/issue21534  opened by zach.ware

#21536: extension built with a shared python cannot be loaded with a s
http://bugs.python.org/issue21536  opened by pitrou

#21539: pathlib's Path.mkdir() should allow for "mkdir -p" functionali
http://bugs.python.org/issue21539  opened by garrison

#21541: Provide configure option --with-ssl for compilation with custo
http://bugs.python.org/issue21541  opened by machyniak

#21546: int('\0') gives wrong error message
http://bugs.python.org/issue21546  opened by Kurt.Rose

#21547: '!s' formatting documentation bug
http://bugs.python.org/issue21547  opened by Joshua.Landau

#21548: pydoc -k IndexError on empty docstring
http://bugs.python.org/issue21548  opened by Dima.Tisnek

#21549: Add the members parameter for TarFile.list()
http://bugs.python.org/issue21549  opened by serhiy.storchaka

#21550: Add Python implementation of the tar utility
http://bugs.python.org/issue21550  opened by serhiy.storchaka

#21552: String length overflow in Tkinter
http://bugs.python.org/issue21552  opened by serhiy.storchaka

#21555: gcmodule.c could use pytime.h
http://bugs.python.org/issue21555  opened by pitrou

#21556: try to use hashtable in pickle
http://bugs.python.org/issue21556  opened by neologix

#21557: os.popen & os.system lack shell-related security warnings
http://bugs.python.org/issue21557  opened by cvrebert

#21558: Fix a typo in the contextlib docs
http://bugs.python.org/issue21558  opened by berker.peksag

#21559: OverflowError should not happen for integer operations
http://bugs.python.org/issue21559  opened by theme

#21560: gzip.write changes trailer ISIZE field before type checking - 
http://bugs.python.org/issue21560  opened by wolma



Most recent 15 issues with no replies (15)
==

#21559: OverflowError should not happen for integer operations
http://bugs.python.org/issue21559

#21558: Fix a typo in the contextlib docs
http://bugs.python.org/issue21558

#21557: os.popen & os.system lack shell-related security warnings
http://bugs.python.org/issue21557

#21552: String length overflow in Tkinter
http://bugs.python.org/issue21552

#21548: pydoc -k IndexError on empty docstring
http://bugs.python.org/issue21548

#21533: built-in types dict docs - construct dict from iterable, not i
http://bugs.python.org/issue21533

#21526: Support new booleans in Tkinter
http://bugs.python.org/issue21526

#21524: Allowing to pass pathlib.Path object in mimetypes.guess_type f
http://bugs.python.org/issue21524

#21521: Tkinter + OSX + Spaces : Multiple file dialogues created
http://bugs.python.org/issue21521

#21514: update json module docs in light of RFC 7159 & ECMA-404
http://bugs.python.org/issue21514

#21505: cx_freeze multiprocessing bug
http://bugs.python.org/issue21505

#21502: freeze.py not working properly with OS X framework builds
http://bugs.python.org/issue21502

#21500: Make use of the "load_tests" protocol in test_importlib packag
http://bugs.python.org/issue21500

#21498: configparser accepts keys beginning with comment_chars when wr
http://bugs.python.org/issue21498

#21493: Add test for ntpath.expanduser
http://bugs.python.org/issue21493



Most recent 15 issues waiting for review (15)
=

#21560: gzip.write changes trailer ISIZE field before type checking - 
http://bugs.python.org/issue21560

#21558: Fix a typo in the contextlib docs
http://bugs.py