summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* * import.c (get_module): pass .py filename to parse_file, not .pyc filename!Guido van Rossum1993-11-301-3/+6
| | | | | | | | | | | * funcobject.c (func_repr): don't call getstringvalue(None) for anonymous functions. * bltinmodule.c: removed lambda (which is now a built-in function); removed implied lambda for string arg to filter/map/reduce. * Grammar, graminit.[ch], compile.[ch]: replaced lambda as built-in function by lambda as grammar entity: instead of "lambda('x: x+1')" you write "lambda x: x+1". * Xtmodule.c (checkargdict): return 0, not NULL, for error.
* Fix lay-out of previous fix.Guido van Rossum1993-11-232-4/+8
|
* * timemodule.c: Add hack for Solaris 2.Guido van Rossum1993-11-234-16/+12
| | | | | | | | | | | | | | | * posixmodule.c: don't prototype getcwd() -- it's not portable... * mappingobject.c: double-check validity of last_name_char in dict{lookup,insert,remove}. * arraymodule.c: need memmove only for non-STDC Suns. * Makefile: comment out HTML_LIBS and XT_USE by default * pythonmain.c: don't prototype getopt() -- it's not standardized * socketmodule.c: cast flags arg to {get,set}sockopt() and addrbuf arg to recvfrom() to (ANY*). * pythonrun.c (initsigs): fix prototype, make it static * intobject.c (LONG_BIT): only #define it if not already defined * classobject.[ch]: remove all references to unused instance_convert() * mappingobject.c (getmappingsize): Don't return NULL in int function.
* * 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].
* Fix the fix :-(Guido van Rossum1993-11-111-1/+3
|
* Three micro fixes to formatstringGuido van Rossum1993-11-111-5/+4
|
* * parsermodule.c, Makefile, config.c: rudimentary interface to the PythonGuido van Rossum1993-11-102-2/+2
| | | | | | parser. * mappingobject.c (lookmapping): 'freeslot' was never used due to a bug in the code.
* * posixmodule.c: added set{uid,gid}.Guido van Rossum1993-11-104-6/+6
| | | | | | * {tuple,list,mapping,array}object.c: call printobject with 0 for flags * compile.c (parsestr): use quote instead of '\'' at one crucial point * arraymodule.c (array_getattr): Added __members__ attribute
* * mpzmodule.c: removed redundant mpz_print function.Guido van Rossum1993-11-052-10/+41
| | | | | | | | | | | | | | * object.[ch], bltinmodule.c, fileobject.c: changed str() to call strobject() which calls an object's __str__ method if it has one. strobject() is also called by writeobject() when PRINT_RAW is passed. * ceval.c: rationalize code for PRINT_ITEM (no change in function!) * funcobject.c, codeobject.c: added compare and hash functionality. Functions with identical code objects and the same global dictionary are equal. Code objects are equal when their code, constants list and names list are identical (i.e. the filename and code name don't count). (hash doesn't work yet since the constants are in a list and lists can't be hashed -- suppose this should really be done with a tuple now we have resizetuple!)
* Added compare operations for functions and code objects.Guido van Rossum1993-11-051-1/+26
| | | | (Also hash, but it doesn't work yet.)
* Added getmappingsize(). (Needed by previous checkin of posixmodule.c)Guido van Rossum1993-11-052-0/+22
|
* * ceval.c, longobject.c, methodobject.c, listnode.c, arraymodule.c,Guido van Rossum1993-11-012-1/+2
| | | | | | pythonrun.c: added static forward declarations * pythonrun.h, ceval.h, longobject.h, node.h: removed declarations of static routines
* * fileobject.c (softspace): fix bug if called with NULL file.Guido van Rossum1993-11-011-1/+1
|
* * rangeobject.{c,h}, bltinmodule.c: removed non-essential ops from rangeGuido van Rossum1993-11-011-80/+28
| | | | object.
* Fixed bugs in resizetuple and extended the interface.Sjoerd Mullender1993-11-012-16/+57
| | | | | Added ifdefs in stringobject.c for shared strings of length 1. Renamed free_list in tupleobject.c to free_tuples.
* * listobject.c (list_ass_slice): XDECREF instead of DECREF soGuido van Rossum1993-10-271-5/+5
| | | | | | setlistslice() can be used to cut the unused part out of a freshly made slice (as done by bagof()). [needed by the next mod!] * structural changes to bagof(), map() etc.
* * compile.[ch]: support for lambda()Guido van Rossum1993-10-262-12/+250
| | | | | | | | | | * PROTO.h, mymalloc.h: added #ifdefs for TURBOC and GNUC. * allobjects.h: added #include "rangeobject.h" * Grammar: added lambda_input; relaxed syntax for exec. * bltinmodule.c: added bagof, map, reduce, lambda, xrange. * tupleobject.[ch]: added resizetuple(). * rangeobject.[ch]: new object type to speed up range operations (not convinced this is needed!!!)
* Add some necessary casts; use double quotes to represent strings inGuido van Rossum1993-10-261-14/+27
| | | | some cases.
* Changes to make range checks portable to 64-bit machines.Guido van Rossum1993-10-261-3/+21
|
* * filemodule.c: added writelines() -- analogous to readlines()Guido van Rossum1993-10-251-0/+42
| | | | * import.c: fixed core dump when out-of-date .pyc file encountered (again!)
* import.c: When something is wrong with the .pyc, properly open the .pySjoerd Mullender1993-10-251-8/+9
| | | | | file. object.c: Write allocation statistics to stderr.
* Several optimizations and speed improvements.Sjoerd Mullender1993-10-226-31/+176
| | | | cstubs: Use Matrix type instead of float[4][4].
* * bltinmodule.c: removed exec() built-in function.Guido van Rossum1993-10-181-0/+10
| | | | | | | * Grammar: add exec statement; allow testlist in expr statement. * ceval.c, compile.c, opcode.h: support exec statement; avoid optimizing locals when it is used * fileobject.{c,h}: add getfilename() internal function.
* intobject.c: Save references to small integers, so that they can beSjoerd Mullender1993-10-153-7/+95
| | | | | | | | | | | | | | | | shared. The default is to save references to the integers in the range -1..99. The lower limit can be set by defining NSMALLNEGINTS (absolute value of smallest integer to be saved) and NSMALLPOSINTS (1 more than the largest integer to be saved). tupleobject.c: Save a reference to the empty tuple to be returned whenever a tuple of size 0 is requested. Tuples of size 1 upto, but not including, MAXSAVESIZE (default 20) are put in free lists when deallocated. When MAXSAVESIZE equals 1, only share references to the empty tuple, when MAXSAVESIZE equals 0, don't include the code at all and revert to the old behavior. object.c: Print some more statistics when COUNT_ALLOCS is defined.
* Makefile, import.c: Lance's alternative module search (allow .pyc fileGuido van Rossum1993-10-151-5/+18
| | | | | | | | | | without .py file); Bill's dynamic loading for SunOS using shared libraries. pwdmodule.c (mkgrent): remove DECREF of uninitialized variable. classobject.c (instance_getattr): Fix case when class lookup returns unbound method instead of function.
* * Extended X interface: pixmap objects, colormap objects visual objects,Sjoerd Mullender1993-10-116-11/+47
| | | | | | | | image objects, and lots of new methods. * Added counting of allocations and deallocations of builtin types if COUNT_ALLOCS is defined. Had to move calls to NEWREF down in some files. * Bug fix in sorting lists.
* * clmodule.c (doParams): free PVbuffer in error condition.Sjoerd Mullender1993-08-031-0/+1
| | | | | * frameobject.c (newframeobject): initialize ob_type if taking entry from the free list, since it is zeroed out when DEBUG is defined.
* Minor fixes / changes for Mac compatibility.Guido van Rossum1993-07-293-5/+5
|
* * accessobject.c (ownercheck): allow a base class access to protectedGuido van Rossum1993-07-112-15/+41
| | | | | | objects of its derived classes; allow anything that has an attribute named "__privileged__" access to anything. * object.[ch]: added hasattr() -- test whether getattr() will succeed.
* * Makefile: added all: and default: targets.Guido van Rossum1993-07-052-8/+1
| | | | | | | | | | | | * many files: made some functions static; removed "extern int errno;". * frozenmain.c: fixed bugs introduced on 24 June... * flmodule.c: remove 1.5 bw compat hacks, add new functions in 2.2a (and some old functions that were omitted). * timemodule.c: added MSDOS floatsleep version . * pgenmain.c: changed exit() to goaway() and added defn of goaway(). * intrcheck.c: add hack (to UNIX only) so interrupting 3 times will exit from a hanging program. The second interrupt prints a message explaining this to the user.
* * Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.Guido van Rossum1993-06-177-8/+42
| | | | | | | | | | Added $(SYSDEF) to its build rule in Makefile. * cgensupport.[ch], modsupport.[ch]: removed some old stuff. Also changed files that still used it... And made several things static that weren't but should have been... And other minor cleanups... * listobject.[ch]: add external interfaces {set,get}listslice * socketmodule.c: fix bugs in new send() argument parsing. * sunaudiodevmodule.c: added flush() and close().
* * classobject.c: in instance_getattr, don't make a method out of aGuido van Rossum1993-05-254-51/+60
| | | | | | | | | | 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.)
* * Lots of small changes related to access.Guido van Rossum1993-05-213-34/+53
| | | | | | | * Added "access *: ...", made access work for class methods. * Introduced subclass check: make sure that when calling ClassName.methodname(instance, ...), the instance is an instance of ClassName or of a subclass thereof (this might break some old code!)
* Access checks now work, at least for instance data (not for methodsGuido van Rossum1993-05-204-88/+503
| | | | | | | 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-195-99/+386
| | | | | | | | | | | | | | | | (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.)
* * pythonrun.c: Print exception type+arg *after* stack trace instead ofGuido van Rossum1993-05-123-11/+34
| | | | | | | before it. * ceval.c, object.c: moved testbool() to object.c (now extern visible) * stringobject.c: fix bugs in and rationalize string resize in formatstring() * tokenizer.[ch]: fix non-working code for lines longer than BUFSIZ
* Fix bug in class instance hash (forgot to clear error condition).Guido van Rossum1993-04-081-3/+8
|
* * Microscopic corrections to make things compile on the Cray APP.Guido van Rossum1993-04-072-2/+8
| | | | | * Removed one use of $> in Makefile and warned about others. Added configurable lines in Makefile to change CC and AR.
* * Fixed some subtleties with fastlocals. You can no longer accessGuido van Rossum1993-03-301-1/+1
| | | | | | | | | | | | | | | | | | f_fastlocals in a traceback object (this is a core dump hazard if there are <nil> entries), but instead eval_code() merges the fast locals back into the locals dictionary if it looks like the local variables will be retained. Also, the merge routines save exceptions since this is sometimes needed (alas!). * Added id() to bltinmodule.c, which returns an object's address (identity). Useful to walk arbitrary data structures containing cycles. * Added compile() to bltinmodule.c and compile_string() to pythonrun.[ch]: support to exec/eval arbitrary code objects. The code that defaults globals and locals is moved from run_node in pythonrun.c (which is now identical to eval_node) to eval_code in ceval.c. [XXX For elegance a clean-up session is necessary.]
* Changes to speed up local variables enormously, by avoiding dictionaryGuido van Rossum1993-03-301-0/+6
| | | | | | lookup (opcode.h, ceval.[ch], compile.c, frameobject.[ch], pythonrun.c, import.c). The .pyc MAGIC number is changed again. Added get_menu_text to flmodule.
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-2914-43/+273
| | | | | | | | | | | | | | | | | * 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
* Generalized version of dictionaries, with compatibility hacks.Guido van Rossum1993-03-272-0/+1410
|
* * Changed many files to use mkvalue() instead of newtupleobject().Guido van Rossum1993-03-165-50/+375
| | | | | | | | | | * Fixcprt.py: added [-y file] option, do only files younger than file. * modsupport.[ch]: added vmkvalue(). * intobject.c: use mkvalue(). * stringobject.c: added "formatstring"; renamed string* to string_*; ceval.c: call formatstring for string % value. * longobject.c: close memory leak in divmod. * parsetok.c: set result node to NULL when returning an error.
* bltinmodule.c: added round(x, [n]); coerce() of two class instancesGuido van Rossum1993-02-121-2/+2
| | | | | | will try to coerce anyway. classobject.c: instance 'nonzero' should first try __nonzero__ only then __len__.
* * stdwinmodule.c: various new commands: setwin{pos,size},Guido van Rossum1993-02-081-12/+8
| | | | | | | | | | listfontnames, bitmap ops. * listobject.c: use mkvalue() when possible; avoid weird error when calling append() without args. * modsupport.c: new feature in getargs(): if the format string contains a semicolor the string after that is used as the error message instead of "bad argument list (format %s)" when there's an error.
* * Added Fixcprt.py: script to fix copyright message.Guido van Rossum1993-01-264-9/+9
| | | | | | | | | | | * various modules: added 1993 to copyright. * thread.c: added copyright notice. * ceval.c: minor change to error message for "+" * stdwinmodule.c: check for error from wfetchcolor * config.c: MS-DOS fixes (define PYTHONPATH, use DELIM, use osdefs.h) * Add declaration of inittab to import.h * sysmodule.c: added sys.builtin_module_names * xxmodule.c, xxobject.c: fix minor errors
* Added separate main program for the Mac: macmain.cGuido van Rossum1993-01-212-3/+6
| | | | | | | | | | | | | | | | | | | | | stdwinmodule.c: wsetfont can now return an error Makefile: add CL_USE and CL_LIB*S; config.c: move CL part around New things in imgfile; also in Makefile. longobject.c: fix comparison of negative long ints... [REAL BUG!] marshal.c: add dumps() and loads() to read/write strings timemodule.c: make sure there's always a floatsleep() posixmodule.c: rationalize struct returned by times() Makefile: add test target, disable imgfile by default thread.c: Improved coexistance with dl module (sjoerd) stdwinmodule.c: Change include stdwin.h if macintosh rotormodule.c: added missing last argument to RTR_?_region calls confic.c: merged with configmac.c, added 1993 to copyright message fileobject.c: int compared to NULL in writestring(); change fopenRF ifdef timemodule.c: simplify times() using mkvalue; include myselect.h earlier (for sequent). posixmodule: for sequent, include unistd.h instead of explicit extern definitions and don't define rename() Makefile: change misleading/wrong MD5 comments
* Checking in last-minute changes that are already part of release 0.9.8Guido van Rossum1993-01-101-2/+3
|
* * Configure.py: use #!/usr/local/bin/pythonGuido van Rossum1993-01-041-0/+4
| | | | | | | | | | | * posixmodule.c: move extern function declarations to top * listobject.c: cmp() arguments must be void* if __STDC__ * Makefile, allobjects.h, panelmodule.c, modsupport.c: get rid of strdup() -- it is a portability risk * Makefile: enclosed ranlib command in parentheses for Sequent Make which aborts if the command is not found even if '-' is present * timemodule.c: time() returns a floating point number, in microsecond precision if BSD_TIME is defined.
* fileobject.c: fix nasty bug; Makefile; turn on STROP and change lint flags.Guido van Rossum1992-12-221-1/+1
|