[issue3122] sys.getsizeof() gives an AttributeError for _sre objects.

Robert Schuppenies report at bugs.python.org
Mon Jun 16 12:51:27 CEST 2008

New submission from Robert Schuppenies <okkotonushi at googlemail.com>:

>>> import re
>>> import sys
>>> r = re.compile('')
>>> sys.getsizeof(r)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: __sizeof__

This applies to objects of the types _sre.SRE_Pattern,
_sre.SRE_Scanner, and _sre.SRE_Match.

The attached patch addresses this issue.

assignee: schuppenies
components: Interpreter Core
files: _sre_sizeof.patch
keywords: patch, patch
messages: 68266
nosy: schuppenies
severity: normal
status: open
title: sys.getsizeof() gives an AttributeError for _sre objects.
type: behavior
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file10639/_sre_sizeof.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list