summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix for SF bug #529050 - ModuleType.__new__ crash.Guido van Rossum2002-03-121-7/+19
| | | | | | | | | | There were several places that assumed the md_dict field was always set, but it needn't be. Fixed these to be more careful. I changed PyModule_GetDict() to initialize md_dict to a new dictionary if it's NULL. Bugfix candidate.
* Add missing "static" declarations (found by "make smelly").Neil Schemenauer2001-10-211-1/+1
|
* Enable GC for new-style instances. This touches lots of files, sinceGuido van Rossum2001-10-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | many types were subclassable but had a xxx_dealloc function that called PyObject_DEL(self) directly instead of deferring to self->ob_type->tp_free(self). It is permissible to set tp_free in the type object directly to _PyObject_Del, for non-GC types, or to _PyObject_GC_Del, for GC types. Still, PyObject_DEL was a tad faster, so I'm fearing that our pystone rating is going down again. I'm not sure if doing something like void xxx_dealloc(PyObject *self) { if (PyXxxCheckExact(self)) PyObject_DEL(self); else self->ob_type->tp_free(self); } is any faster than always calling the else branch, so I haven't attempted that -- however those types whose own dealloc is fancier (int, float, unicode) do use this pattern.
* Add optional docstrings to member descriptors. For backwardsGuido van Rossum2001-09-201-1/+1
| | | | | | | | | | | | | | | compatibility, this required all places where an array of "struct memberlist" structures was declared that is referenced from a type's tp_members slot to change the type of the structure to PyMemberDef; "struct memberlist" is now only used by old code that still calls PyMember_Get/Set. The code in PyObject_GenericGetAttr/SetAttr now calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef argument. As examples, I added actual docstrings to the attributes of a few types: file, complex, instance method, super, and xxsubtype.spamlist. Also converted the symtable to new style getattr.
* Use new GC API.Neil Schemenauer2001-08-291-6/+6
|
* repr's converted to using PyString_FromFormat() instead of sprintf'ingBarry Warsaw2001-08-241-17/+2
| | | | | | into a hardcoded char* buffer. Closes patch #454743.
* module_repr(): Instead of fixing the maximum buf size to 400,Barry Warsaw2001-08-161-6/+18
| | | | | | | | calculate it on the fly. This way even modules with long package names get an accurate repr instead of a truncated one. The extra malloc/free cost shouldn't be a problem in a repr function. Closes SF bug #437984
* Merge of descr-branch back into trunk.Tim Peters2001-08-021-61/+40
|
* Repair "module has no attribute xxx" error msg; bug introduced whenTim Peters2001-05-121-1/+1
| | | | switching from tp_getattr to tp_getattro.
* Variant of patch #423262: Change module attribute get & setTim Peters2001-05-111-34/+35
| | | | | | Allow module getattr and setattr to exploit string interning, via the previously null module object tp_getattro and tp_setattro slots. Yields a very nice speedup for things like random.random and os.path etc.
* Add garbage collection for module objects. Closes patch #102939 andNeil Schemenauer2001-01-021-2/+27
| | | | fixes bug #126345.
* Ka-Ping Yee <ping@lfw.org>:Fred Drake2000-10-241-5/+22
| | | | | | Changes to error messages to increase consistency & clarity. This (mostly) closes SourceForge patch #101839.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* ANSI-fication of the sources.Fred Drake2000-07-091-21/+9
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-1/+1
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* Patch by Chris Petrilli to display the origin of a module in itsGuido van Rossum1999-02-151-3/+30
| | | | repr() -- either "(builtin)" or "from '<filename>'".
* Replace fprintf(stderr, ...) with PySys_WriteStderr(...).Guido van Rossum1998-10-121-2/+2
|
* Add internal routine _PyModule_Clear(), which does approximately whatGuido van Rossum1998-02-191-1/+50
| | | | | | | | | clear_carefully() used to do in import.c. Differences: leave only __builtins__ alone in the 2nd pass; and don't clear the dictionary (on the theory that as long as there are references left to the dictionary, those might be destructors that might expect __builtins__ to be alive when they run; and __builtins__ can't normally be part of a cycle).
* removed last #ifdef SUPPORT_OBSOLETE_ACCESS bits.Guido van Rossum1997-05-091-16/+2
|
* Quickly renamed the last directory.Guido van Rossum1997-05-021-63/+64
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Disable support for access statementGuido van Rossum1996-08-121-0/+6
|
* apply dictclear to dict of deleted modulesGuido van Rossum1995-01-261-1/+3
|
* initialize __doc__ to NoneGuido van Rossum1995-01-071-0/+2
|
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
| | | | | floatobject.c: fix hash(). methodobject.c: support METH_FREENAME flag bit.
* Merge back to main trunkGuido van Rossum1994-08-301-5/+5
|
* * import.c (get_module): total rewrite, to ensure proper search order: forGuido van Rossum1993-11-171-21/+30
| | | | | | | | | | | | | each dir in sys.path, try each possible extension. (Note: C extensions are loaded before Python modules in the same directory, to allow having a C version used when dynamic loading is supported and a Python version as a back-up.) * import.c (reload_module): test for error from getmodulename() * moduleobject.c: implement module name as dict entry '__name__' instead of special-casing it in module_getattr(); this way a module (or function!) can access its own module name, and programs that know what they are doing can rename modules. * stdwinmodule.c (initstdwin): strip ".py" suffix of argv[0].
* * classobject.c: in instance_getattr, don't make a method out of aGuido van Rossum1993-05-251-2/+2
| | | | | | | | | | function found as instance data. * socketmodule.c: added 'flags' argument sendto/recvfrom, rewrite argument parsing in send/recv. * More changes related to access (terminology change: owner instead of class; allow any object as owner; local/global variables are owned by their dictionary, only class/instance data is owned by the class; "from...import *" now only imports objects with public access; etc.)
* Access checks now work, at least for instance data (not for methodsGuido van Rossum1993-05-201-2/+3
| | | | | | | yet). The class is now passed to eval_code and stored in the current frame. It is also stored in instance method objects. An "unbound" instance method is now returned when a function is retrieved through "classname.funcname", which when called passes the class to eval_code.
* Several changes in one:Guido van Rossum1993-05-191-5/+16
| | | | | | | | | | | | | | | | (1) dictionaries/mappings now have attributes values() and items() as well as keys(); at the C level, use the new function mappinggetnext() to iterate over a dictionary. (2) "class C(): ..." is now illegal; you must write "class C: ...". (3) Class objects now know their own name (finally!); and minor improvements to the way how classes, functions and methods are represented as strings. (4) Added an "access" statement and semantics. (This is still experimental -- as long as you don't use the keyword 'access' nothing should be changed.)
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+2
| | | | | | | | | | | | | | | | | * Stubs for faster implementation of local variables (not yet finished) * Added function name to code object. Print it for code and function objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version number has changed accordingly) * Print address of self for built-in methods * New internal functions getattro and setattro (getattr/setattr with string object arg) * Replaced "dictobject" with more powerful "mappingobject" * New per-type functio tp_hash to implement arbitrary object hashing, and hashobject() to interface to it * Added built-in functions hash(v) and hasattr(v, 'name') * classobject: made some functions static that accidentally weren't; added __hash__ special instance method to implement hash() * Added proper comparison for built-in methods and functions
* * Makefile: added IMGFILE; moved some stuff around.Guido van Rossum1992-09-171-12/+1
| | | | | | | | * flmodule.c: added some missing functions; changed readonly flags of some data members based upon FORMS documentation. * listobject.c: fixed int/long arg lint bug (bites PC compilers). * several: removed redundant print methods (repr is good enough). * posixmodule.c: added (still experimental) process group functions.
* classobject.c moduleobject.c stdwinmodule.c xxobject.c:Guido van Rossum1992-09-041-3/+8
| | | | | raise AttributeError, not KeyError, when attribute deletion fails. sunaudiodevmodule.c: check for deletion before calling setmember.
* Copyright for 1992 addedGuido van Rossum1992-04-051-1/+1
|
* LintGuido van Rossum1992-03-271-1/+2
|
* Use new exceptions.Guido van Rossum1991-12-101-2/+2
|
* printobject now returns an error codeGuido van Rossum1991-06-071-1/+2
|
* Added copyright notice.Guido van Rossum1991-02-191-0/+24
|
* Return -1 for errors.Guido van Rossum1990-12-201-1/+1
|
* "Compiling" versionGuido van Rossum1990-12-201-47/+22
|
* Added getmodulename() public interface.Guido van Rossum1990-10-261-0/+11
|
* Added __dict to module getattr.Guido van Rossum1990-10-211-6/+21
| | | | New errors.
* New error handling in getattr().Guido van Rossum1990-10-141-4/+3
|
* Initial revisionGuido van Rossum1990-10-141-0/+130