Commit Graph

265 Commits

Author SHA1 Message Date
Georg Brandl 09a7c72cad Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl 2daf6ae249 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Petri Lehtinen 9713321f46 Document absoluteness of sys.executable
Closes #13402.
2012-02-02 20:59:50 +02:00
Jesus Cea 7124f5f7e8 MERGE: Up-port changeset 5cf8f6da8743 (closes #11890) 2011-04-20 20:32:52 +02:00
Jesus Cea 1d4ae84e53 Up-port changeset 5cf8f6da8743 (closes #11890) 2011-04-20 20:24:57 +02:00
Victor Stinner 27181ac778 sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not
called yet: detect bootstrap (startup) issues earlier.
2011-03-31 13:39:03 +02:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Georg Brandl 13039c87f1 Merge build identification to 3.2 branch. 2011-03-06 10:13:00 +01:00
Georg Brandl 1ca2e7965c Commit the hg build identification patch from the pymigr repo. 2011-03-05 20:51:24 +01:00
Raymond Hettinger 90e8f8cd9b Fix count of flag fields. Being one short caused the 'quiet' option not to print. 2011-01-05 20:08:25 +00:00
Georg Brandl 8aa7e999b5 Add sys.flags.quiet attribute for the new -q option, as noted missing by Eric in #1772833. 2010-12-28 18:30:18 +00:00
Victor Stinner 13d49ee7d6 Issue #10601: sys.displayhook uses 'backslashreplace' error handler on
UnicodeEncodeError.
2010-12-04 17:24:33 +00:00
Georg Brandl e5b99f0fb3 Remove redundant includes of headers that are already included by Python.h. 2010-11-30 09:41:01 +00:00
Georg Brandl 71c23d4473 Include structseq.h in Python.h, and remove now-redundant includes in individual sources. 2010-11-30 09:30:54 +00:00
Victor Stinner 07e4f1565b sys_update_path(): update sys.path even if argc==0 2010-10-25 17:37:23 +00:00
Benjamin Peterson 8035bc5c04 follow up to #9778: define and use an unsigned hash type 2010-10-23 16:20:50 +00:00
Antoine Pitrou 9583cac633 Issue #10089: Add support for arbitrary -X options on the command-line.
They can be retrieved through a new attribute `sys._xoptions`.
2010-10-21 13:42:28 +00:00
Benjamin Peterson 8f67d0893f make hashes always the size of pointers; introduce Py_hash_t #9778 2010-10-17 20:54:53 +00:00
Barry Warsaw 8cf4eae522 First (uncontroversial) part of issue 9807.
* Expose the build flags to Python as sys.abiflags
* Shared library libpythonX.Y<abiflags>.so
* python-config --abiflags
* Make two distutils tests that failed with --enable-shared (even before this
  patch) succeed.
* Fix a few small style issues.
2010-10-16 01:04:07 +00:00
Victor Stinner 015f4d87ab _Py_wrealpath() requires the size of the output buffer 2010-10-07 22:29:53 +00:00
Victor Stinner 4e31443c4d Create fileutils.c/.h
* _Py_fopen() and _Py_stat() come from Python/import.c
 * (_Py)_wrealpath() comes from Python/sysmodule.c
 * _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from Modules/main.c
 * (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from Modules/getpath.c
2010-10-07 21:45:39 +00:00
Victor Stinner 7ae7c87b05 _wrealpath() and _Py_wreadlink() support surrogates (PEP 383)
Use _Py_wchar2char() to support surrogate characters in the input path.
2010-10-07 11:06:49 +00:00
Victor Stinner c08ec9fdba Create a subfunction for PySys_SetArgvEx()
Create sys_update_path() static function. Do nothing if argc==0.
2010-10-06 22:44:06 +00:00
Victor Stinner 5b519e0201 Issue #9632: Remove sys.setfilesystemencoding() function: use PYTHONFSENCODING
environment variable to set the filesystem encoding at Python startup.
sys.setfilesystemencoding() creates inconsistencies because it is unable to
reencode all filenames in all objects.
2010-09-10 21:57:59 +00:00
Antoine Pitrou fce7fd6426 Issue #9549: sys.setdefaultencoding() and PyUnicode_SetDefaultEncoding()
are now removed, since their effect was inexistent in 3.x (the default
encoding is hardcoded to utf-8 and cannot be changed).
2010-09-01 18:54:56 +00:00
Nick Coghlan d26c18adcc Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory 2010-08-17 13:06:11 +00:00
Victor Stinner 79766636b6 Issue #9599: Create PySys_FormatStdout() and PySys_FormatStderr()
Write a message formatted by PyUnicode_FromFormatV() to sys.stdout and
sys.stderr.
2010-08-16 17:36:42 +00:00
Matthias Klose d885e95be4 - sysmodule.c (get_hash_info): Define as static function. 2010-07-06 10:53:30 +00:00
Victor Stinner a01c6b3c9e Merged revisions 81841 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r81841 | victor.stinner | 2010-06-08 22:46:00 +0200 (mar., 08 juin 2010) | 6 lines

  sys_pyfile_write() does nothing if file is NULL

  mywrite() falls back to the C file object if sys_pyfile_write() returns an
  error. This patch fixes a segfault is Py_FatalError() is called in an early
  stage of Python initialization.
........
2010-06-08 20:50:09 +00:00
Victor Stinner ecccc4f9b8 sys_pyfile_write() does nothing if file is NULL
mywrite() falls back to the C file object if sys_pyfile_write() returns an
error. This patch fixes a segfault is Py_FatalError() is called in an early
stage of Python initialization.
2010-06-08 20:46:00 +00:00
Victor Stinner 7eeb5b5e50 Issue #8848: U / U# formats of Py_BuildValue() are just alias to s / s# 2010-06-07 19:57:46 +00:00
Mark Dickinson dc787d2055 Issue #8188: Introduce a new scheme for computing hashes of numbers
(instances of int, float, complex, decimal.Decimal and
fractions.Fraction) that makes it easy to maintain the invariant that
hash(x) == hash(y) whenever x and y have equal value.
2010-05-23 13:33:13 +00:00
Antoine Pitrou 71d305c83d Merged revisions 81400 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81400 | antoine.pitrou | 2010-05-21 19:25:34 +0200 (ven., 21 mai 2010) | 12 lines

  Merged revisions 81398 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81398 | antoine.pitrou | 2010-05-21 19:12:38 +0200 (ven., 21 mai 2010) | 6 lines

    Issue #5753: A new C API function, :cfunc:`PySys_SetArgvEx`, allows
    embedders of the interpreter to set sys.argv without also modifying
    sys.path.  This helps fix `CVE-2008-5983
    <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983>`_.
  ........
................
2010-05-21 17:33:14 +00:00
Antoine Pitrou f978facc0e Merged revisions 81398 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81398 | antoine.pitrou | 2010-05-21 19:12:38 +0200 (ven., 21 mai 2010) | 6 lines

  Issue #5753: A new C API function, :cfunc:`PySys_SetArgvEx`, allows
  embedders of the interpreter to set sys.argv without also modifying
  sys.path.  This helps fix `CVE-2008-5983
  <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983>`_.
........
2010-05-21 17:25:34 +00:00
Victor Stinner 9ca9c25bcd Issue #8589: Decode PYTHONWARNINGS environment variable with the file system
encoding and surrogateespace error handler instead of the locale encoding to be
consistent with os.environ. Add PySys_AddWarnOptionUnicode() function.
2010-05-19 16:53:30 +00:00
Antoine Pitrou 7f14f0d8a0 Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines

  Recorded merge of revisions 81029 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

    Untabify C files. Will watch buildbots.
  ........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Victor Stinner 32366b45e8 Merged revisions 80404 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r80404 | victor.stinner | 2010-04-23 14:02:30 +0200 (ven., 23 avril 2010) | 4 lines

  Issue #8124: PySys_WriteStdout() and PySys_WriteStderr() don't execute
  indirectly Python signal handlers anymore because mywrite() ignores exceptions
  (KeyboardInterrupt).
........
2010-04-23 12:04:53 +00:00
Victor Stinner 14284c2f3b Issue #8124: PySys_WriteStdout() and PySys_WriteStderr() don't execute
indirectly Python signal handlers anymore because mywrite() ignores exceptions
(KeyboardInterrupt).
2010-04-23 12:02:30 +00:00
Florent Xicluna d7494de5bf Merged revisions 78622 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78622 | florent.xicluna | 2010-03-03 12:54:54 +0100 (mer, 03 mar 2010) | 9 lines

  Merged revisions 78620 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78620 | florent.xicluna | 2010-03-03 12:49:53 +0100 (mer, 03 mar 2010) | 2 lines

    Revert a nonexistent docstring typo, r42805.
  ........
................
2010-03-03 11:55:53 +00:00
Florent Xicluna 5749e85b53 Merged revisions 78620 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78620 | florent.xicluna | 2010-03-03 12:49:53 +0100 (mer, 03 mar 2010) | 2 lines

  Revert a nonexistent docstring typo, r42805.
........
2010-03-03 11:54:54 +00:00
Eric Smith f7bb57875a Merged revisions 77763 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77763 | eric.smith | 2010-01-26 19:28:29 -0500 (Tue, 26 Jan 2010) | 1 line

  Issue #7766: Change sys.getwindowsversion() return value to a named tuple and add the additional members returned in an OSVERSIONINFOEX structure. The new members are service_pack_major, service_pack_minor, suite_mask, and product_type.
........
2010-01-27 00:44:57 +00:00
Antoine Pitrou aee355b7b5 Remove obsolete comment. 2009-11-10 22:38:52 +00:00
Antoine Pitrou 074e5ed974 Merge in the new GIL. 2009-11-10 19:50:40 +00:00
Georg Brandl bcc484e6d6 Merged revisions 74062 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

................
  r74062 | alexandre.vassalotti | 2009-07-17 13:43:26 +0200 (Fr, 17 Jul 2009) | 37 lines

  Merged revisions 73665,73693,73704-73705,73707,73712-73713,73824 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r73665 | alexandre.vassalotti | 2009-06-28 21:01:51 -0400 (Sun, 28 Jun 2009) | 2 lines

    Update docstrings for sys.getdlopenflags() and sys.setdlopenflags().
  ........
    r73693 | jesse.noller | 2009-06-29 14:20:34 -0400 (Mon, 29 Jun 2009) | 1 line

    Bug 5906: add a documentation note for unix daemons vs. multiprocessing daemons
  ........
    r73704 | georg.brandl | 2009-06-30 12:15:43 -0400 (Tue, 30 Jun 2009) | 1 line

    #6376: fix copy-n-paste oversight.
  ........
    r73705 | georg.brandl | 2009-06-30 12:17:28 -0400 (Tue, 30 Jun 2009) | 1 line

    #6374: add a bit of explanation about shell=True on Windows.
  ........
    r73707 | georg.brandl | 2009-06-30 12:35:11 -0400 (Tue, 30 Jun 2009) | 1 line

    #6371: fix link targets.
  ........
    r73712 | ezio.melotti | 2009-06-30 18:51:06 -0400 (Tue, 30 Jun 2009) | 1 line

    Fixed defaultTestCase -> defaultTestResult
  ........
    r73713 | ezio.melotti | 2009-06-30 18:56:16 -0400 (Tue, 30 Jun 2009) | 1 line

    Fixed a backslash that was not supposed to be there
  ........
    r73824 | ezio.melotti | 2009-07-03 21:18:08 -0400 (Fri, 03 Jul 2009) | 1 line

    #6398 typo: versio. -> version.
  ........
................
2009-08-13 11:51:54 +00:00
Alexandre Vassalotti 260484d12a Merged revisions 73665,73693,73704-73705,73707,73712-73713,73824 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73665 | alexandre.vassalotti | 2009-06-28 21:01:51 -0400 (Sun, 28 Jun 2009) | 2 lines

  Update docstrings for sys.getdlopenflags() and sys.setdlopenflags().
........
  r73693 | jesse.noller | 2009-06-29 14:20:34 -0400 (Mon, 29 Jun 2009) | 1 line

  Bug 5906: add a documentation note for unix daemons vs. multiprocessing daemons
........
  r73704 | georg.brandl | 2009-06-30 12:15:43 -0400 (Tue, 30 Jun 2009) | 1 line

  #6376: fix copy-n-paste oversight.
........
  r73705 | georg.brandl | 2009-06-30 12:17:28 -0400 (Tue, 30 Jun 2009) | 1 line

  #6374: add a bit of explanation about shell=True on Windows.
........
  r73707 | georg.brandl | 2009-06-30 12:35:11 -0400 (Tue, 30 Jun 2009) | 1 line

  #6371: fix link targets.
........
  r73712 | ezio.melotti | 2009-06-30 18:51:06 -0400 (Tue, 30 Jun 2009) | 1 line

  Fixed defaultTestCase -> defaultTestResult
........
  r73713 | ezio.melotti | 2009-06-30 18:56:16 -0400 (Tue, 30 Jun 2009) | 1 line

  Fixed a backslash that was not supposed to be there
........
  r73824 | ezio.melotti | 2009-07-03 21:18:08 -0400 (Fri, 03 Jul 2009) | 1 line

  #6398 typo: versio. -> version.
........
2009-07-17 11:43:26 +00:00
Benjamin Peterson 94c65d9a8f Merged revisions 72907 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72907 | benjamin.peterson | 2009-05-24 21:40:21 -0500 (Sun, 24 May 2009) | 1 line

  handle errors from _PyObject_LookupSpecial when __get__ fails
........
2009-05-25 03:10:48 +00:00
Benjamin Peterson f53eec8801 Merged revisions 72871-72872 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72871 | benjamin.peterson | 2009-05-23 14:24:37 -0500 (Sat, 23 May 2009) | 1 line

  support building with subversion 1.7 #6094
........
  r72872 | benjamin.peterson | 2009-05-23 14:31:02 -0500 (Sat, 23 May 2009) | 1 line

  reorder name
........
2009-05-23 19:36:27 +00:00
Benjamin Peterson a5758c0120 Merged revisions 72508 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72508 | benjamin.peterson | 2009-05-09 11:36:39 -0500 (Sat, 09 May 2009) | 1 line

  convert some more special methods to use _PyObject_LookupSpecial
........
2009-05-09 18:15:04 +00:00
Mark Dickinson b08a53a99d Issue #1580: use short float repr where possible.
- incorporate and adapt David Gay's dtoa and strtod
   into the Python core
 - on platforms where we can use Gay's code (almost
   all!), repr(float) is based on the shortest
   sequence of decimal digits that rounds correctly.
 - add sys.float_repr_style attribute to indicate
   whether we're using Gay's code or not
 - add autoconf magic to detect and enable SSE2
   instructions on x86/gcc
 - slight change to repr and str:  repr switches
   to exponential notation at 1e16 instead of
   1e17, str switches at 1e11 instead of 1e12
2009-04-16 19:52:09 +00:00