Commit Graph

178 Commits

Author SHA1 Message Date
Brett Cannon
be1501b976 Fix sys.flags to properly expose bytes_warning.
Closes issue #2790.
2008-05-08 20:23:06 +00:00
Christian Heimes
af748c3ab8 Implemented PEP 370 2008-05-06 22:41:46 +00:00
Benjamin Peterson
f19a7b90bd A little reformating of Py3k warnings 2008-04-27 18:40:21 +00:00
Benjamin Peterson
9f4f48114f Use PyErr_WarnPy3k throughout 2008-04-27 03:01:45 +00:00
Benjamin Peterson
858a77099e Fix indentation in sysmodule.c 2008-04-18 20:45:33 +00:00
Brett Cannon
40f0a87666 Fix a bug in PySys_HasWarnOption() where it was not properly checking the
length of the list storing the warning options.
2008-04-13 00:18:44 +00:00
Brett Cannon
e974689038 Re-implement the 'warnings' module in C. This allows for usage of the
'warnings' code in places where it was previously not possible (e.g., the
parser). It could also potentially lead to a speed-up in interpreter start-up
if the C version of the code (_warnings) is imported over the use of the
Python version in key places.

Closes issue #1631171.
2008-04-12 23:44:07 +00:00
Georg Brandl
d5b635f196 Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
2008-03-25 08:29:14 +00:00
Christian Heimes
a113bd9f69 Added quick hack for bzr 2008-03-24 19:58:17 +00:00
Christian Heimes
6a453c3750 Added quick hack for bzr 2008-03-24 19:57:42 +00:00
Georg Brandl
5a44424c5e #2358: add py3k warning to sys.exc_clear(). 2008-03-21 20:11:46 +00:00
Christian Heimes
422051a367 Patch #1953
I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers.
The patch also renames sys._cleartypecache to sys._clear_type_cache
2008-02-04 18:00:12 +00:00
Christian Heimes
796fc31585 The previous change was causing a segfault after multiple calls to Py_Initialize() and Py_Finalize(). 2008-01-30 18:58:29 +00:00
Christian Heimes
0d9244332b Fixed some references leaks in sys. 2008-01-30 17:21:22 +00:00
Christian Heimes
908caac52e Added clear cache methods to clear the internal type lookup cache for ref leak test runs. 2008-01-27 23:34:59 +00:00
Georg Brandl
56112895d6 #1648: add sys.gettrace() and sys.getprofile(). 2008-01-20 13:59:46 +00:00
Andrew M. Kuchling
7ce9b18460 Typo fixes 2008-01-15 01:29:16 +00:00
Christian Heimes
f31b69f9db Applied patch #1816: sys.flags patch 2008-01-14 03:42:48 +00:00
Georg Brandl
2da0fceba7 Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode. 2008-01-07 17:09:35 +00:00
Christian Heimes
dfdfaab1c5 Feature #1534
Added PyFloat_GetMax(), PyFloat_GetMin() and PyFloat_GetInfo() to the float API.
Added a dictionary sys.float_info with information about the internal floating point type to the sys module.
2007-12-01 11:20:10 +00:00
Christian Heimes
28104c58d2 Expose Py_Py3kWarningFlag as sys.py3kwarning as discussed in #1504
Also added a warning.warnpy3k() as convenient method for Python 3.x related deprecation warnings.
2007-11-27 23:16:44 +00:00
Neal Norwitz
68cdf8a6da SF #1701207, Fix bogus assertion (and test it!) 2007-04-16 07:37:55 +00:00
Thomas Wouters
afea529088 SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomize
When running the interpreter in an environment that would cause it to set
stdout/stderr/stdin's encoding, having a sitecustomize that would replace
them with something other than PyFile objects would crash the interpreter.
Fix it by simply ignoring the encoding-setting for non-files.

This could do with a test, but I can think of no maintainable and portable
way to test this bug, short of adding a sitecustomize.py to the buildsystem
and have it always run with it (hmmm....)
2007-01-23 13:42:00 +00:00
Neal Norwitz
837ce9389e Add some asserts. In sysmodule, I think these were to try to silence
some warnings from Klokwork.  They verify the assumptions of the format
of svn version output.

The assert in the thread module helped debug a problem on HP-UX.
2006-10-28 21:15:30 +00:00
Armin Rigo
7ccbca93a2 Forward-port of r52136,52138: a review of overflow-detecting code.
* unified the way intobject, longobject and mystrtoul handle
  values around -sys.maxint-1.

* in general, trying to entierely avoid overflows in any computation
  involving signed ints or longs is extremely involved.  Fixed a few
  simple cases where a compiler might be too clever (but that's all
  guesswork).

* more overflow checks against bad data in marshal.c.

* 2.5 specific: fixed a number of places that were still confusing int
  and Py_ssize_t.  Some of them could potentially have caused
  "real-world" breakage.

* list.pop(x): fixing overflow issues on x was messy.  I just reverted
  to PyArg_ParseTuple("n"), which does the right thing.  (An obscure
  test was trying to give a Decimal to list.pop()... doesn't make
  sense any more IMHO)

* trying to write a few tests...
2006-10-04 12:17:45 +00:00