| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
(AttributeError, TypeError) -- the leniency wasn't needed everywhere.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
| |
This uses the new "restricted" feature of structmember, and getset
descriptors for some of the type checks.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
added a test of a coredump that would occur when del'ing
func_defaults (put here for convenience).
|
|
|
|
| |
new module.
|
|
Closes SF patch #103123.
Regression test for function attributes, with output file.
|