summaryrefslogtreecommitdiffstats
path: root/Objects/intobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-1/+1
| | | | | | | | | | comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
* ANSI-fication of the sources.Fred Drake2000-07-091-89/+38
|
* Cray J90 fixes for long ints.Tim Peters2000-07-081-4/+1
| | | | | | | | | | | | | | | | This was a convenient excuse to create the pyport.h file recently discussed! Please use new Py_ARITHMETIC_RIGHT_SHIFT when right-shifting a signed int and you *need* sign-extension. This is #define'd in pyport.h, keying off new config symbol SIGNED_RIGHT_SHIFT_ZERO_FILLS. If you're running on a platform that needs that symbol #define'd, the std tests never would have worked for you (in particular, at least test_long would have failed). The autoconfig stuff got added to Python after my Unix days, so I don't know how that works. Would someone please look into doing & testing an auto-config of the SIGNED_RIGHT_SHIFT_ZERO_FILLS symbol? It needs to be defined if & only if, e.g., (-1) >> 3 is not -1.
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Trent Mick <trentm@activestate.com>:Fred Drake2000-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The common technique for printing out a pointer has been to cast to a long and use the "%lx" printf modifier. This is incorrect on Win64 where casting to a long truncates the pointer. The "%p" formatter should be used instead. The problem as stated by Tim: > Unfortunately, the C committee refused to define what %p conversion "looks > like" -- they explicitly allowed it to be implementation-defined. Older > versions of Microsoft C even stuck a colon in the middle of the address (in > the days of segment+offset addressing)! The result is that the hex value of a pointer will maybe/maybe not have a 0x prepended to it. Notes on the patch: There are two main classes of changes: - in the various repr() functions that print out pointers - debugging printf's in the various thread_*.h files (these are why the patch is large) Closes SourceForge patch #100505.
* Replace PyErr_BadArgument() error in PyInt_AsLong() with "an integerGuido van Rossum2000-05-091-1/+1
| | | | | is required" (we can't say more because we don't know in which context it is called).
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-8/+6
| | | | | | | | | | 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.)
* Marc-Andre's third try at this bulk patch seems to work (except thatGuido van Rossum2000-04-051-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | his copy of test_contains.py seems to be broken -- the lines he deleted were already absent). Checkin messages: New Unicode support for int(), float(), complex() and long(). - new APIs PyInt_FromUnicode() and PyLong_FromUnicode() - added support for Unicode to PyFloat_FromString() - new encoding API PyUnicode_EncodeDecimal() which converts Unicode to a decimal char* string (used in the above new APIs) - shortcuts for calls like int(<int object>) and float(<float obj>) - tests for all of the above Unicode compares and contains checks: - comparing Unicode and non-string types now works; TypeErrors are masked, all other errors such as ValueError during Unicode coercion are passed through (note that PyUnicode_Compare does not implement the masking -- PyObject_Compare does this) - contains now works for non-string types too; TypeErrors are masked and 0 returned; all other errors are passed through Better testing support for the standard codecs. Misc minor enhancements, such as an alias dbcs for the mbcs codec. Changes: - PyLong_FromString() now applies the same error checks as does PyInt_FromString(): trailing garbage is reported as error and not longer silently ignored. The only characters which may be trailing the digits are 'L' and 'l' -- these are still silently ignored. - string.ato?() now directly interface to int(), long() and float(). The error strings are now a little different, but the type still remains the same. These functions are now ready to get declared obsolete ;-) - PyNumber_Int() now also does a check for embedded NULL chars in the input string; PyNumber_Long() already did this (and still does) Followed by: Looks like I've gone a step too far there... (and test_contains.py seem to have a bug too). I've changed back to reporting all errors in PyUnicode_Contains() and added a few more test cases to test_contains.py (plus corrected the join() NameError).
* Many changes for Unicode, by Marc-Andre Lemburg.Guido van Rossum2000-03-101-1/+1
|
* In response to one particular complaint on edu-sig, change some errorGuido van Rossum2000-02-151-3/+3
| | | | | | messages from "OverflowError: integer pow()" to "OverflowError: integer exponentiation". (Not that this takes care of the complaint in general that the error messages could be greatly improved. :-)
* The rest of the changes by Trent Mick and Dale Nagata for warning-freeGuido van Rossum2000-01-201-1/+1
| | | | compilation on NT Alpha. Mostly added casts etc.
* Mainlining the string_methods branch. See branch revision logBarry Warsaw1999-10-121-0/+43
| | | | messages for specific changes.
* Patch by Tim Peters fixing PR#88:Guido van Rossum1999-09-271-1/+7
| | | | Integer division can crash under Windows.
* Fix a problem with Vladimir's PyInt_Fini code: clear the free list; ifGuido van Rossum1999-03-191-5/+27
| | | | | | a block cannot be freed, add its free items back to the free list, and add its valid ints back to the small_ints array if they are in range. This is necessary to avoid leaking when Python is reinitialized later.
* Vladimir has restructured his code somewhat so that the blocks are nowGuido van Rossum1999-03-121-26/+47
| | | | | | | represented by an explicit structure. (There are still too many casts in the code, but that may be unavoidable.) Also added code so that with -vv it is very chatty about what it does.
* Patch by Vladimir Marangoz to allow freeing of the allocated blocks ofGuido van Rossum1999-03-101-15/+64
| | | | integers on finalization.
* Added _Fini() routines to free up some memoryGuido van Rossum1997-08-051-0/+17
|
* Quickly renamed the last directory.Guido van Rossum1997-05-021-156/+163
|
* Increased buffer sizes used by hex() and oct() -- on 64-bit or 128-bitGuido van Rossum1997-01-141-2/+2
| | | | machines, the string may get longer than 20 characters!
* Changed hex() and oct() again, to never emit a '-' sign.Guido van Rossum1997-01-121-7/+2
|
* Subtle change to hex/oct formatting so the largest negative numberGuido van Rossum1997-01-101-2/+2
| | | | does not receive a minus sign.
* Fix overflow test for multiply to catch some cases it missed.Guido van Rossum1997-01-061-2/+4
| | | | Added warning about dependency of float/complex hash on int hash.
* Fix core dump from pow(x,y,0).Guido van Rossum1996-12-061-7/+9
| | | | Make gcc -Wall happy.
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* fix memory leak and null pointer dereferenceGuido van Rossum1995-01-101-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.
* Lots of minor changes. Note for mappingobject.c: the hash table pointerGuido van Rossum1995-01-021-1/+0
| | | | can now be NULL.
* mods by Andrew Kuchling to implementGuido van Rossum1994-08-291-41/+240
| | | | | pow(x,y,z) == pow(x,y)%z, but without incurring overflow Correct problems found by THINK C 6.0
* Added getmaxint() so sys can initialize sys.maxint.Guido van Rossum1993-12-241-0/+6
| | | | Added Makefile.in.
* * timemodule.c: Add hack for Solaris 2.Guido van Rossum1993-11-231-0/+2
| | | | | | | | | | | | | | | * 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.
* Changes to make range checks portable to 64-bit machines.Guido van Rossum1993-10-261-3/+21
|
* intobject.c: Save references to small integers, so that they can beSjoerd Mullender1993-10-151-0/+37
| | | | | | | | | | | | | | | | 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.
* * Extended X interface: pixmap objects, colormap objects visual objects,Sjoerd Mullender1993-10-111-1/+1
| | | | | | | | 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.
* * Microscopic corrections to make things compile on the Cray APP.Guido van Rossum1993-04-071-2/+2
| | | | | * Removed one use of $> in Makefile and warned about others. Added configurable lines in Makefile to change CC and AR.
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-12/+20
| | | | | | | | | | | | | | | | | * 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
* * Changed many files to use mkvalue() instead of newtupleobject().Guido van Rossum1993-03-161-14/+4
| | | | | | | | | | * 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.
* Made builtins int(), long(), float(), oct() and hex() more generic.Guido van Rossum1992-09-121-0/+59
|
* Copyright for 1992 addedGuido van Rossum1992-04-051-1/+1
|
* lint fixGuido van Rossum1992-03-271-2/+3
|
* Make / and % do the same as divmod.Guido van Rossum1992-01-191-117/+67
|
* Different shift implementation.Guido van Rossum1992-01-141-2/+34
|
* Improved exceptions.Guido van Rossum1991-12-101-13/+15
|
* Added shift and mask ops.Guido van Rossum1991-10-241-1/+107
|
* printobject now returns an error codeGuido van Rossum1991-06-071-1/+2
|
* Added nonzero testGuido van Rossum1991-05-141-0/+8
|
* Added divmod and abs, fixed negative powersGuido van Rossum1991-05-051-18/+70
|
* Added copyright notice.Guido van Rossum1991-02-191-0/+24
|
* "Compiling" versionGuido van Rossum1990-12-201-41/+73
|
* Fix zero division checks: return if it occurs!Guido van Rossum1990-10-261-3/+3
|