summaryrefslogtreecommitdiff
path: root/Objects/moduleobject.c
AgeCommit message (Collapse)AuthorLines
2002-03-15backport gvanrossum's checkin ofMichael W. Hudson-7/+19
revision 2.41 of moduleobject.c Fix for SF bug #529050 - ModuleType.__new__ crash. 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.
2001-10-21Add missing "static" declarations (found by "make smelly").Neil Schemenauer-1/+1
2001-10-05Enable GC for new-style instances. This touches lots of files, sinceGuido van Rossum-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.
2001-09-20Add optional docstrings to member descriptors. For backwardsGuido van Rossum-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.
2001-08-29Use new GC API.Neil Schemenauer-6/+6
2001-08-24repr's converted to using PyString_FromFormat() instead of sprintf'ingBarry Warsaw-17/+2
into a hardcoded char* buffer. Closes patch #454743.
2001-08-16module_repr(): Instead of fixing the maximum buf size to 400,Barry Warsaw-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
2001-08-02Merge of descr-branch back into trunk.Tim Peters-61/+40
2001-05-12Repair "module has no attribute xxx" error msg; bug introduced whenTim Peters-1/+1
switching from tp_getattr to tp_getattro.
2001-05-11Variant of patch #423262: Change module attribute get & setTim Peters-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.
2001-01-02Add garbage collection for module objects. Closes patch #102939 andNeil Schemenauer-2/+27
fixes bug #126345.
2000-10-24Ka-Ping Yee <ping@lfw.org>:Fred Drake-5/+22
Changes to error messages to increase consistency & clarity. This (mostly) closes SourceForge patch #101839.
2000-09-01REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum-9/+0
This should match the situation in the 1.6b1 tree.
2000-07-09ANSI-fication of the sources.Fred Drake-21/+9
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6
2000-05-03Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum-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.)
1999-02-15Patch by Chris Petrilli to display the origin of a module in itsGuido van Rossum-3/+30
repr() -- either "(builtin)" or "from '<filename>'".
1998-10-12Replace fprintf(stderr, ...) with PySys_WriteStderr(...).Guido van Rossum-2/+2
1998-02-19Add internal routine _PyModule_Clear(), which does approximately whatGuido van Rossum-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).
1997-05-09removed last #ifdef SUPPORT_OBSOLETE_ACCESS bits.Guido van Rossum-16/+2
1997-05-02Quickly renamed the last directory.Guido van Rossum-63/+64
1996-10-25New permission notice, includes CNRI.Guido van Rossum-12/+19
1996-08-12Disable support for access statementGuido van Rossum-0/+6
1995-01-26apply dictclear to dict of deleted modulesGuido van Rossum-1/+3
1995-01-07initialize __doc__ to NoneGuido van Rossum-0/+2
1995-01-04Added 1995 to copyright message.Guido van Rossum-2/+2
floatobject.c: fix hash(). methodobject.c: support METH_FREENAME flag bit.
1994-08-30Merge back to main trunkGuido van Rossum-5/+5
1993-11-17* import.c (get_module): total rewrite, to ensure proper search order: forGuido van Rossum-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].
1993-05-25* classobject.c: in instance_getattr, don't make a method out of aGuido van Rossum-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.)
1993-05-20Access checks now work, at least for instance data (not for methodsGuido van Rossum-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.
1993-05-19Several changes in one:Guido van Rossum-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.)
1993-03-29* Changed all copyright messages to include 1993.Guido van Rossum-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
1992-09-17* Makefile: added IMGFILE; moved some stuff around.Guido van Rossum-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.
1992-09-04classobject.c moduleobject.c stdwinmodule.c xxobject.c:Guido van Rossum-3/+8
raise AttributeError, not KeyError, when attribute deletion fails. sunaudiodevmodule.c: check for deletion before calling setmember.
1992-04-05Copyright for 1992 addedGuido van Rossum-1/+1
1992-03-27LintGuido van Rossum-1/+2
1991-12-10Use new exceptions.Guido van Rossum-2/+2
1991-06-07printobject now returns an error codeGuido van Rossum-1/+2
1991-02-19Added copyright notice.Guido van Rossum-0/+24
1990-12-20Return -1 for errors.Guido van Rossum-1/+1
1990-12-20"Compiling" versionGuido van Rossum-47/+22
1990-10-26Added getmodulename() public interface.Guido van Rossum-0/+11
1990-10-21Added __dict to module getattr.Guido van Rossum-6/+21
New errors.
1990-10-14New error handling in getattr().Guido van Rossum-4/+3
1990-10-14Initial revisionGuido van Rossum-0/+130