Commit Graph

136 Commits

Author SHA1 Message Date
Antoine Pitrou 853395b448 Issue #18621: Prevent the site module's patched builtins from keeping too many references alive for too long. 2013-08-06 22:56:40 +02:00
Antoine Pitrou f93c7b8061 Remove Lib/site.py hack to unregister patched builtins.
It creates a refleak in subinterpreters, as atexit callbacks aren't triggered at their end.
2013-08-01 19:46:04 +02:00
Antoine Pitrou dcedaf6e53 Issue #18214: Improve finalization of Python modules to avoid setting their globals to None, in most cases. 2013-07-31 23:14:08 +02:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Mark Dickinson 9d351332a7 Issue #5845: avoid an exception at startup on OS X if no .editrc file exists. 2013-05-06 15:39:31 +02:00
Antoine Pitrou 1a6cb30a34 Issue #5845: Enable tab-completion in the interactive interpreter by default, thanks to a new sys.__interactivehook__.
(original patch by Éric Araujo)
2013-05-04 20:08:35 +02:00
Meador Inge 2581bdb86a Issue #16804: Fix 'python -S -m site' failure.
This commit fixes a bug in the 'site' module that was causing an exception
to incorrectly be thrown when running 'python -S -m site'.  The problem was
that 'USER_BASE' and 'USER_SITE' were being accessed before they were properly
initialized.  The code has been changed to use 'getuserbase' and
'getusersitepackages' instead so that the initialization always happens.
2013-04-13 20:51:04 -05:00
Meador Inge 9a7a81195c Issue #16804: Fix 'python -S -m site' failure.
This commit fixes a bug in the 'site' module that was causing an exception
to incorrectly be thrown when running 'python -S -m site'.  The problem was
that 'USER_BASE' and 'USER_SITE' were being accessed before they were properly
initialized.  The code has been changed to use 'getuserbase' and
'getusersitepackages' instead so that the initialization always happens.
2013-04-13 20:29:49 -05:00
Roger Serwy 663a390454 #17585: merge with 3.3. 2013-04-11 19:18:22 -05:00
Roger Serwy 1eafd1076e #17585: Fixed IDLE regression. Now closes when using exit() or quit(). 2013-04-11 19:16:44 -05:00
Giampaolo Rodola' 2f50aaf2ff modernize some modules' code by using with statement around open() 2013-02-12 02:04:27 +01:00
Brett Cannon 13252b8770 Issue #16972: Have site.addpackage() consider known paths even when
none are explicitly passed in.
2013-01-25 13:57:16 -05:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov ad28c7f9da Issue #16706: get rid of os.error 2012-12-18 22:02:39 +02:00
Vinay Sajip 70adf6f72f Closes #16519: Merged fix from 3.3. 2012-11-23 19:21:46 +00:00
Vinay Sajip 27e4b6059e Issue #16519: Used os.path.abspath, removed unnecessary code for executable_name. 2012-11-23 19:16:49 +00:00
Christian Heimes de0b962998 Remove sys.platform == 'riscos' checks from some Python and test files. #16501 2012-11-19 00:59:39 +01:00
Jesus Cea 4791a24268 #16135: Removal of OS/2 support (Python code partial cleanup) 2012-10-05 03:15:39 +02:00
Vinay Sajip abd344cbab Issue 15241: Improved site.py documentation relating to venvs. 2012-07-03 16:33:57 +01:00
Vinay Sajip 2895244653 Closes #15173: Tidied up copyright statements and removed pythonv references. 2012-06-25 00:47:46 +01:00
Vinay Sajip 7ded1f0f69 Implemented PEP 405 (Python virtual environments). 2012-05-26 03:45:29 +01:00
Brett Cannon fd0741555b Issue #2377: Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Victor Stinner 65532111b4 site: don't import traceback at startup to speed up Python startup 2012-02-21 22:10:16 +01:00
Florent Xicluna 54540ec917 Remove redundant imports. 2011-11-04 08:29:17 +01:00
Victor Stinner 4e86d5b88d Replace open(filename, 'rU') by open(filename, 'r')
The U flag is no more used (but still accepted for backward compatibility).
2011-05-04 13:55:36 +02:00
Éric Araujo c09fca67e7 Do not touch sys.path when site is imported and python was started with -S.
Original patch by Carl Meyer, review by Brett Cannon, small doc editions by
yours truly.  Fixes #11591.
2011-03-23 02:06:24 +01:00
R. David Murray b4ca59b783 #5258/#10642: print fn, line, traceback and continue when .pth file is broken
If a .pth file contained an error, it could cause a traceback in site.py,
terminating its processing.  In 2.7 and 3.2, the interpreter will then not
start.  Previously, a message would print saying to use -v to get the
traceback.  In either case, the traceback generated for a failed .pth file did
not include the .pth filename, making it difficult to debug the problem.  Now
site.py reports not only the .pth filename but also the line number causing the
error, and just skips the remainder of the file.
2010-12-26 19:54:29 +00:00
Victor Stinner b103a937ea Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the
current directory was deleted.
2010-10-12 22:23:23 +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
Antoine Pitrou e9b428f997 Reimplement addbuilddir() in C inside getpath.c, so as to execute it
at interpreter startup before importing any non-builtin modules.
Should fix #9589.
2010-08-13 22:25:01 +00:00
Ronald Oussoren bda4672b01 Ensure that test_site actually passes with a framework build 2010-08-01 09:02:50 +00:00
Benjamin Peterson 3e5cd1d04e Merged revisions 81465-81466,81468,81679,81735,81760,81868,82183 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81465 | georg.brandl | 2010-05-22 06:29:19 -0500 (Sat, 22 May 2010) | 2 lines

  Issue #3924: Ignore cookies with invalid "version" field in cookielib.
........
  r81466 | georg.brandl | 2010-05-22 06:31:16 -0500 (Sat, 22 May 2010) | 1 line

  Underscore the name of an internal utility function.
........
  r81468 | georg.brandl | 2010-05-22 06:43:25 -0500 (Sat, 22 May 2010) | 1 line

  #8635: document enumerate() start parameter in docstring.
........
  r81679 | benjamin.peterson | 2010-06-03 16:21:03 -0500 (Thu, 03 Jun 2010) | 1 line

  use a set for membership testing
........
  r81735 | michael.foord | 2010-06-05 06:46:59 -0500 (Sat, 05 Jun 2010) | 1 line

  Extract error message truncating into a method (unittest.TestCase._truncateMessage).
........
  r81760 | michael.foord | 2010-06-05 14:38:42 -0500 (Sat, 05 Jun 2010) | 1 line

  Issue 8302. SkipTest exception is setUpClass or setUpModule is now reported as a skip rather than an error.
........
  r81868 | benjamin.peterson | 2010-06-09 14:45:04 -0500 (Wed, 09 Jun 2010) | 1 line

  fix code formatting
........
  r82183 | benjamin.peterson | 2010-06-23 15:29:26 -0500 (Wed, 23 Jun 2010) | 1 line

  cpython only gc tests
........
2010-06-27 21:45:24 +00:00
Ronald Oussoren 4cda46ab91 Merged revisions 80967 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80967 | ronald.oussoren | 2010-05-08 12:29:06 +0200 (Sat, 08 May 2010) | 4 lines

  Issue #8084: ensure that the --user directory
  conforms to platforms standars on OSX when
  using a python framework.
........
2010-05-08 10:49:43 +00:00
Barry Warsaw 28a691b7fd PEP 3147 2010-04-17 00:19:56 +00:00
Brian Curtin fb1d3c1cc7 Merged revisions 80022 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80022 | brian.curtin | 2010-04-12 18:30:49 -0500 (Mon, 12 Apr 2010) | 2 lines

  Fix #8364. Update the setquit docstring and change a built-in to builtin.
........
2010-04-12 23:33:42 +00:00
Florent Xicluna fd1b0930ce Merged revisions 79297,79310,79382,79425-79427,79450 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79297 | florent.xicluna | 2010-03-22 18:18:18 +0100 (lun, 22 mar 2010) | 2 lines

  #7668: Fix test_httpservers failure when sys.executable contains non-ASCII bytes.
........
  r79310 | florent.xicluna | 2010-03-22 23:52:11 +0100 (lun, 22 mar 2010) | 2 lines

  Issue #8205: Remove the "Modules" directory from sys.path when Python is running from the build directory (POSIX only).
........
  r79382 | florent.xicluna | 2010-03-24 20:33:25 +0100 (mer, 24 mar 2010) | 2 lines

  Skip tests which depend on multiprocessing.sharedctypes, if _ctypes is not available.
........
  r79425 | florent.xicluna | 2010-03-25 21:32:07 +0100 (jeu, 25 mar 2010) | 2 lines

  Syntax cleanup `== None` -> `is None`
........
  r79426 | florent.xicluna | 2010-03-25 21:33:49 +0100 (jeu, 25 mar 2010) | 2 lines

  #8207: Fix test_pep277 on OS X
........
  r79427 | florent.xicluna | 2010-03-25 21:39:10 +0100 (jeu, 25 mar 2010) | 2 lines

  Fix test_unittest and test_warnings when running "python -Werror -m test.regrtest"
........
  r79450 | florent.xicluna | 2010-03-26 20:32:44 +0100 (ven, 26 mar 2010) | 2 lines

  Ensure that the failed or unexpected tests are sorted before printing.
........
2010-03-28 00:25:02 +00:00
Victor Stinner 52f6dd7a3d Merged revisions 78826 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78826 | victor.stinner | 2010-03-10 23:30:19 +0100 (mer., 10 mars 2010) | 5 lines

  Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt
  (SIGINT). If an error occurs while importing the site module, the error is
  printed and Python exits. Initialize the GIL before importing the site
  module.
........
2010-03-12 14:45:56 +00:00
Tarek Ziadé edacea30e4 Merged revisions 77704,77752 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77704 | tarek.ziade | 2010-01-23 10:23:15 +0100 (Sat, 23 Jan 2010) | 1 line

  taking sysconfig out of distutils
........
  r77752 | tarek.ziade | 2010-01-26 00:19:56 +0100 (Tue, 26 Jan 2010) | 1 line

  switched the call order so this call works without suffering from issue #7774
........
2010-01-29 11:41:03 +00:00
Tarek Ziadé 4a608c0619 Merged revisions 74526 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74526 | tarek.ziade | 2009-08-20 23:23:13 +0200 (Thu, 20 Aug 2009) | 1 line

  #6693: New functions in site.py to get user/global site packages paths.
........
2009-08-20 21:28:05 +00:00
Ronald Oussoren fa1fcd107d Merged revisions 70778 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70778 | ronald.oussoren | 2009-03-30 18:10:35 -0500 (Mon, 30 Mar 2009) | 4 lines

  Fix issue #4865: add /Library/Python/2.7/site-packages to
  sys.path on OSX, to make it easier to share (some) installed
  packages between the system install and a user install.
........
2009-03-30 23:16:10 +00:00
Alexandre Vassalotti a79e33e039 Merged revisions 62954-62959,62961,62963-62967,62969-62970,62972-62973,62975-62976,62978-62982,62984,62987-62996 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62954 | martin.v.loewis | 2008-05-09 16:11:37 -0400 (Fri, 09 May 2008) | 1 line

  Port to VS 2008. Drop W9x support.
........
  r62957 | benjamin.peterson | 2008-05-09 17:30:26 -0400 (Fri, 09 May 2008) | 2 lines

  In stdtypes.rst, move methods under class directives where applicable
........
  r62958 | brett.cannon | 2008-05-09 17:30:36 -0400 (Fri, 09 May 2008) | 2 lines

  Add a todo list to the module deletion command.
........
  r62963 | brett.cannon | 2008-05-09 18:52:28 -0400 (Fri, 09 May 2008) | 2 lines

  Add support for extension modules in 3.0 deprection command.
........
  r62967 | brett.cannon | 2008-05-09 22:25:00 -0400 (Fri, 09 May 2008) | 2 lines

  Fix some errors in the deprecation warnings for new and user.
........
  r62975 | brett.cannon | 2008-05-09 22:54:52 -0400 (Fri, 09 May 2008) | 3 lines

  Suppress deprecations for packages as well when using
  test.test_support.import_module().
........
  r62976 | brett.cannon | 2008-05-09 22:57:03 -0400 (Fri, 09 May 2008) | 2 lines

  Also ignore package deprecations.
........
  r62982 | benjamin.peterson | 2008-05-09 23:08:17 -0400 (Fri, 09 May 2008) | 2 lines

  Add the examples in the json module docstring as a doctest
........
  r62992 | martin.v.loewis | 2008-05-10 09:24:09 -0400 (Sat, 10 May 2008) | 2 lines

  Explicitly refer to current hhp file (2.6a3)
........
  r62993 | skip.montanaro | 2008-05-10 10:48:49 -0400 (Sat, 10 May 2008) | 2 lines

  Note the PyPI-edness of bsddb185 for people who might still need it.
........
  r62994 | andrew.kuchling | 2008-05-10 13:36:24 -0400 (Sat, 10 May 2008) | 1 line

  Docstring typo
........
  r62995 | andrew.kuchling | 2008-05-10 13:37:05 -0400 (Sat, 10 May 2008) | 1 line

  Document the 'line' argument
........
  r62996 | andrew.kuchling | 2008-05-10 13:48:45 -0400 (Sat, 10 May 2008) | 1 line

  #1625509: describe behaviour of import lock
........
2008-05-15 22:51:26 +00:00
Alexandre Vassalotti 6461e10158 Merged revisions 62914-62916,62918-62919,62921-62922,62924-62942,62944-62945,62947-62949 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62914 | skip.montanaro | 2008-05-08 20:45:00 -0400 (Thu, 08 May 2008) | 4 lines

  Add an example about using NamedTemporaryFile() to replace mktemp().  I'm
  unclear whether the verbatim text should have been indented or by how much.
........
  r62915 | benjamin.peterson | 2008-05-08 20:50:40 -0400 (Thu, 08 May 2008) | 2 lines

  reindent example
........
  r62927 | georg.brandl | 2008-05-09 02:09:25 -0400 (Fri, 09 May 2008) | 2 lines

  #2788: add .hgignore file.
........
  r62928 | georg.brandl | 2008-05-09 02:10:43 -0400 (Fri, 09 May 2008) | 2 lines

  #2781: fix function name.
........
  r62929 | georg.brandl | 2008-05-09 02:18:27 -0400 (Fri, 09 May 2008) | 2 lines

  Add a sentence to basicConfig() that is in the docstring.
........
  r62930 | georg.brandl | 2008-05-09 02:26:54 -0400 (Fri, 09 May 2008) | 2 lines

  Add another link to colorsys docs.
........
  r62931 | georg.brandl | 2008-05-09 02:36:07 -0400 (Fri, 09 May 2008) | 2 lines

  Add Kodos as a re reference.
........
  r62932 | georg.brandl | 2008-05-09 02:39:58 -0400 (Fri, 09 May 2008) | 2 lines

  Add a note about using reload().
........
  r62933 | andrew.kuchling | 2008-05-09 07:46:05 -0400 (Fri, 09 May 2008) | 3 lines

  Update planned release date.
  Uncomment PEP 370 section.
  Add some module items
........
  r62934 | christian.heimes | 2008-05-09 08:19:09 -0400 (Fri, 09 May 2008) | 1 line

  Add --user option to build_ext
........
  r62948 | mark.dickinson | 2008-05-09 13:54:23 -0400 (Fri, 09 May 2008) | 3 lines

  Issue #2487.  math.ldexp(x, n) raised OverflowError when n was large and
  negative; fix to return an (appropriately signed) zero instead.
........
  r62949 | martin.v.loewis | 2008-05-09 14:21:55 -0400 (Fri, 09 May 2008) | 1 line

  Use the CHM file name that Sphinx assigns.
........
2008-05-15 22:09:29 +00:00
Christian Heimes 8dc226fccd Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62774 | georg.brandl | 2008-05-06 19:11:42 +0200 (Tue, 06 May 2008) | 2 lines

  #2773: fix description of 'g' and 'G' formatting spec.
........
  r62775 | georg.brandl | 2008-05-06 19:20:54 +0200 (Tue, 06 May 2008) | 2 lines

  > != (!<).
........
  r62785 | benjamin.peterson | 2008-05-07 00:18:11 +0200 (Wed, 07 May 2008) | 2 lines

  Fix logic error in Python/_warnings.c and add a test to verify
........
  r62787 | benjamin.peterson | 2008-05-07 00:31:52 +0200 (Wed, 07 May 2008) | 2 lines

  Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning
........
  r62788 | christian.heimes | 2008-05-07 00:41:46 +0200 (Wed, 07 May 2008) | 1 line

  Implemented PEP 370
........
2008-05-06 23:45:46 +00:00
Christian Heimes 1af737cd1e Merged revisions 60176-60209 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60178 | georg.brandl | 2008-01-21 22:05:49 +0100 (Mon, 21 Jan 2008) | 2 lines

  #1715: include sub-extension modules in pydoc text output.
........
  r60179 | georg.brandl | 2008-01-21 22:14:21 +0100 (Mon, 21 Jan 2008) | 2 lines

  Add a "const" to make gcc happy.
........
  r60180 | georg.brandl | 2008-01-21 22:19:07 +0100 (Mon, 21 Jan 2008) | 2 lines

  Add the correct build dir when building with pydebug.
........
  r60181 | georg.brandl | 2008-01-21 22:23:15 +0100 (Mon, 21 Jan 2008) | 3 lines

  Patch #1720595: add T_BOOL to the range of structmember types.
  Patch by Angelo Mottola, reviewed by MvL, tests by me.
........
  r60182 | georg.brandl | 2008-01-21 22:28:32 +0100 (Mon, 21 Jan 2008) | 2 lines

  Reformat some ugly code.
........
  r60187 | brett.cannon | 2008-01-22 00:50:16 +0100 (Tue, 22 Jan 2008) | 4 lines

  Make's MAKEFLAGS variable is set to a string containing the single-letter
  arguments to Make. This means there are no hyphens. Fix the '-s' check to
  silence distutils to now work.
........
  r60188 | gregory.p.smith | 2008-01-22 01:19:41 +0100 (Tue, 22 Jan 2008) | 3 lines

  accepts and closes issue #1221598: adds an optional callback to ftplib.FTP
  storbinary() and storlines() methods.
........
  r60189 | gregory.p.smith | 2008-01-22 02:12:02 +0100 (Tue, 22 Jan 2008) | 2 lines

  Replace spam.acquire() try: ... finally: spam.release() with "with spam:"
........
  r60190 | gregory.p.smith | 2008-01-22 02:20:42 +0100 (Tue, 22 Jan 2008) | 4 lines

  - Fix Issue #1703448: A joined thread could show up in the
    threading.enumerate() list after the join() for a brief period until
    it actually exited.
........
  r60193 | georg.brandl | 2008-01-22 08:53:31 +0100 (Tue, 22 Jan 2008) | 2 lines

  Fix \xhh specs, #1889.
........
  r60198 | christian.heimes | 2008-01-22 16:01:25 +0100 (Tue, 22 Jan 2008) | 1 line

  Fixed a missing (X) in define
........
  r60199 | christian.heimes | 2008-01-22 16:25:18 +0100 (Tue, 22 Jan 2008) | 2 lines

  Don't repeat yourself
  Added the macros PyModule_AddIntMacro and PyModule_AddStringMacro. They shorten PyModule_AddIntConstant(m, "AF_INET", AF_INET) to PyModule_AddIntMacro(m, AF_INET)
........
  r60201 | raymond.hettinger | 2008-01-22 20:51:41 +0100 (Tue, 22 Jan 2008) | 1 line

  Document when to use izip_longest().
........
  r60202 | georg.brandl | 2008-01-22 20:56:03 +0100 (Tue, 22 Jan 2008) | 2 lines

  Fix for #1087741 patch.
........
  r60203 | raymond.hettinger | 2008-01-22 21:18:53 +0100 (Tue, 22 Jan 2008) | 1 line

  Give zip() the same guarantee as izip() for left-to-right evaluation.
........
  r60204 | raymond.hettinger | 2008-01-22 23:09:26 +0100 (Tue, 22 Jan 2008) | 1 line

  Improve variable name in sample code
........
  r60205 | gregory.p.smith | 2008-01-23 00:15:34 +0100 (Wed, 23 Jan 2008) | 2 lines

  docstring and comment updates suggested by Giampaolo Rodola'
........
  r60207 | raymond.hettinger | 2008-01-23 01:04:40 +0100 (Wed, 23 Jan 2008) | 1 line

  Let pprint() support sets and frozensets (suggested by David Mertz).
........
  r60208 | guido.van.rossum | 2008-01-23 02:18:27 +0100 (Wed, 23 Jan 2008) | 4 lines

  I'm tired of these tests breaking at Google due to our large number of
  users and groups in LDAP/NIS.  So I'm limiting the extra-heavy part of
  the tests to passwd/group files with at most 1000 entries.
........
2008-01-23 08:24:23 +00:00
Georg Brandl d348b2587e Remove several mentions of old Python versions that don't apply anymore. 2008-01-05 20:00:55 +00:00
Christian Heimes 862543aa85 Don't close sys.stdin with quit() if sys.stdin wraps fd 0. Otherwise it will raise a warning: Lib/io.py:1221: RuntimeWarning: Trying to close unclosable fd 2007-12-31 03:07:24 +00:00
Guido van Rossum 704b34d9e4 Fix issue #1667. The _Printer() class was using sys.stdin.readline()
instead of input() to read the user's input (since at some point in
the past raw_input() was removed), but the code used to decode the
input wasn't changed.  Fixed it by going back to input(), which has
since been added back with the same semantics as the old raw_input().
2007-12-20 18:42:56 +00:00
Georg Brandl 1a3284ed69 #1535: rename __builtin__ module to builtins. 2007-12-02 09:40:06 +00:00
Guido van Rossum ce3a72aec6 Patch 1267 by Christian Heimes.
Move the initialization of sys.std{in,out,err} and __builtin__.open
to C code.
This solves the problem that "python -S" wouldn't work.
2007-10-19 23:16:50 +00:00