summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_funcattrs.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix unittest conversion breakage.Georg Brandl2008-02-051-29/+30
|
* Rewrite test_funcattrs as unittest, written for GHOP by Jeff Wheeler.Georg Brandl2008-02-021-413/+280
|
* Replaced import of the 'new' module with 'types' module and added a ↵Christian Heimes2007-11-271-2/+2
| | | | deprecation warning to the 'new' module.
* Issue #1445: Fix a SystemError when accessing the ``cell_contents``Amaury Forgeot d'Arc2007-11-241-0/+12
| | | | attribute of an empty cell object. Now a ValueError is raised.
* FixMichael W. Hudson2005-02-171-0/+3
| | | | | | | | [ 1124295 ] Function's __name__ no longer accessible in restricted mode which I introduced with a bit of mindless copy-paste when making __name__ writable. You can't assign to __name__ in restricted mode, which I'm going to pretend was intentional :)
* Wrote down the invariants of some common objects whose structure isArmin Rigo2004-10-281-2/+11
| | | | | | | | | | exposed in header files. Fixed a few comments in these headers. As we might have expected, writing down invariants systematically exposed a (minor) bug. In this case, function objects have a writeable func_code attribute, which could be set to code objects with the wrong number of free variables. Calling the resulting function segfaulted the interpreter. Added a corresponding test.
* Whitespace normalization.Tim Peters2004-08-131-1/+1
|
* This is my patchMichael W. Hudson2004-08-121-2/+9
| | | | | | | [ 1004703 ] Make func_name writable plus fixing a couple of nits in the documentation changes spotted by MvL and a Misc/NEWS entry.
* Provide __module__ attributes for functions defined in C and Python.Jeremy Hylton2003-01-311-0/+4
| | | | | | | | | | | | | | __module__ is the string name of the module the function was defined in, just like __module__ of classes. In some cases, particularly for C functions, the __module__ may be None. Change PyCFunction_New() from a function to a macro, but keep an unused copy of the function around so that we don't change the binary API. Change pickle's save_global() to use whichmodule() if __module__ is None, but add the __module__ logic to whichmodule() since it might be used outside of pickle.
* Complete the absolute import patch for the test suite. All relativeBarry Warsaw2002-07-301-1/+1
| | | | | | | | imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed.
* Fix for SF bug #472940: can't getattr() attribute shown by dir()Guido van Rossum2001-10-221-5/+5
| | | | | | | | | | There really isn't a good reason for instance method objects to have their own __dict__, __doc__ and __name__ properties that just delegate the request to the function (callable); the default attribute behavior already does this. The test suite had to be fixed because the error changes from TypeError to AttributeError.
* Undo some (but not all) of the more lenient acceptance ofGuido van Rossum2001-09-181-9/+9
| | | | (AttributeError, TypeError) -- the leniency wasn't needed everywhere.
* - Some tests that check that assignments are not allowed expect thisGuido van Rossum2001-09-181-85/+95
| | | | | | | | | | | | | | | | to raise TypeError. In practice, a disallowed attribute assignment can raise either TypeError or AttributeError (and it's unclear which is better). So allow either. (Yes, this is in anticipation of a code change that switches the exception raised. :-) - Add a utility function, cantset(), which verifies that setting a particular attribute to a given value is disallowed, and also that deleting that same attribute is disallowed. Use this in the test_func_*() tests. - Add a new set of tests that test conformance of various instance method attributes. (Also in anticipation of code that changes their implementation.)
* Rewrite function attributes to use the generic routines properly.Guido van Rossum2001-09-171-1/+158
| | | | | This uses the new "restricted" feature of structmember, and getset descriptors for some of the type checks.
* Test the new semantics for setting and deleting a function's __dict__Barry Warsaw2001-08-141-45/+50
| | | | | | | | | attribute. Deleting it, or setting it to a non-dictionary result in a TypeError. Note that getting it the first time magically initializes it to an empty dict so that func.__dict__ will always appear to be a dictionary (never None). Closes SF bug #446645.
* Additional tests for current, PEP described semantics:Barry Warsaw2001-02-261-3/+36
| | | | | | | | | | | | - func.__dict__ is None until the first attribute is assigned - del func.__dict__ is equivalent to func.__dict__ = None - disallowing assignment to function attribute through unbound method (it was always illegal to assign through bound method). - verifying that setting attribute explicitly on underlying function via meth.im_func is okay.
* Whitespace normalization.Tim Peters2001-02-091-4/+3
|
* The one thing I love more then writing code is deleting code.Moshe Zadka2001-01-291-0/+19
| | | | | | | | | * Removed func_hash and func_compare, so they can be treated as immutable content-less objects (address hash and comparison) * Added tests to that affect to test_funcattrs (also testing func_code is writable) * Reverse meaning of tests in test_opcodes which checked identical code gets identical functions
* Add some regression tests of coredump bugs in funcobject.c 2.31. AlsoBarry Warsaw2001-01-191-0/+16
| | | | | added a test of a coredump that would occur when del'ing func_defaults (put here for convenience).
* Add a test case suggested by Guido, where a method is created with theBarry Warsaw2001-01-151-0/+38
| | | | new module.
* Committing PEP 232, function attribute feature, approved by Guido.Barry Warsaw2001-01-151-0/+102
Closes SF patch #103123. Regression test for function attributes, with output file.