Commit graph

45 commits

Author SHA1 Message Date
Barry Warsaw e1f14643dc
gh-98040: Remove just the imp module (#98573) 2023-04-28 16:17:58 -07:00
Humbled Drugman 117836f123
bpo-26792: Improve docstrings of runpy module run_functions (#30729)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-04-29 12:22:46 -06:00
Christian Heimes 16638a4bdb
bpo-45654: No need to freeze types (GH-30028) 2021-12-10 19:09:09 +01:00
Victor Stinner bd9154a495
bpo-41718: runpy now imports pkgutil in functions (GH-24996)
Reduce the number of modules imported by "python3 -m module".

The runpy module no longer imports at startup (in the module body),
but only in functions using it: _get_code_from_file() and run_path().
2021-03-23 19:22:57 +01:00
Pablo Galindo ef67512b40
bpo-40108: Improve the error message in runpy when importing a module that includes the extension (GH-19239) 2020-03-31 12:23:55 +01:00
Maor Kleinberger 0911ea5c17
bpo-39517: Allow runpy.run_path() to accept path-like objects (GH-18699) 2020-03-08 20:43:17 +00:00
jsnklln e243bae999 bpo-38722: Runpy use io.open_code() (GH-17234)
https://bugs.python.org/issue38722



Automerge-Triggered-By: @taleinat
2019-11-18 11:11:13 -08:00
Martin Panter f9ed528faf Issue #27487: Merge runpy warning from 3.5 2016-08-21 05:07:35 +00:00
Martin Panter 9c8aa9bffe Issue #27487: Warn if submodule already imported before runpy execution
Also try to clarify the find_spec() error message.
2016-08-21 04:07:58 +00:00
Brett Cannon fdcdd9ed80 Issue #26896: Disambiguate uses of "importer" with "finder".
Thanks to Oren Milman for the patch.
2016-07-08 11:00:00 -07:00
Martin Panter dda584340e Issue #19771: Omit irrelevant message if package could not be initialized 2015-12-12 06:58:55 +00:00
Martin Panter 7dda421bff Issue #14285: Do not catch exceptions initializing any ancestor package
The previous fix only handled the case of the parent package of __main__
failing to initialize.

Also make the "Error while finding spec" formatting slightly more appealing,
and document and test that the module name must be absolute.
2015-12-10 06:47:06 +00:00
Martin Panter 657257edb6 Issue #14285: Do not catch __init__.py exceptions in runpy
Initialize package before calling find_spec() for __main__, so that we do not
incorrectly handle exceptions from __init__.py. When runpy is used from the
Python CLI, use an internal exception rather than ImportError, to avoid
catching unexpected exceptions.

Also remove exception message rewriting in _run_module_as_main(), because it
seems to be redundant with the _get_main_module_details() function.
2015-12-03 01:23:10 +00:00
Eric Snow 32439d6eb6 Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
Brett Cannon 2a17bde930 Issue #20383: Introduce importlib.util.module_from_spec().
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
2014-05-30 14:55:29 -04:00
Victor Stinner 7fa767e517 Issue #20976: pyflakes: Remove unused imports 2014-03-20 09:16:38 +01:00
Eric Snow 6029e08691 Issue 19944: Fix importlib.find_spec() so it imports parents as needed.
The function is also moved to importlib.util.
2014-01-25 15:32:46 -07:00
Nick Coghlan 720c7e28cb Issue #19700: set __spec__ appropriately in runpy
Note that __spec__.name is not currently guaranteed to be in
sys.modules when the code is running, only __name__ is.

The "running module is in sys.modules" invariant will be
expanded to also cover __spec__.name in a subsequent patch.
2013-12-15 20:33:02 +10:00
Brett Cannon e4f41deccf Issue #17177: The imp module is pending deprecation.
To make sure there is no issue with code that is both Python 2 and 3
compatible, there are no plans to remove the module any sooner than
Python 4 (unless the community moves to Python 3 solidly before then).
2013-06-16 13:13:40 -04:00
Brett Cannon 82d2107668 Issue #17177: switch from imp.new_module to types.ModuleType for runpy 2013-06-15 14:27:21 -04:00
Nick Coghlan be7e49fd82 Close #15386: There was a loophole that meant importlib.machinery and imp would sometimes reference an uninitialised copy of importlib._bootstrap 2012-07-20 23:40:09 +10:00
Nick Coghlan 8dbe5b5568 Remove a statement that was only added for debugging purposes 2012-07-15 18:29:24 +10:00
Nick Coghlan 85e729ec3b Take the first step in resolving the messy pkgutil vs importlib edge cases by basing pkgutil explicitly on importlib, deprecating its internal import emulation and setting __main__.__loader__ correctly so that runpy still works (Affects #15343, #15314, #15357) 2012-07-15 18:09:52 +10:00
Nick Coghlan 2f54b98c8c Merge fix for #15230 from 3.2 2012-07-15 00:07:43 +10:00
Nick Coghlan 761bb11374 Close #15230: runpy.run_path now sets __package__ correctly. Also refactored the runpy tests to use a more systematic approach 2012-07-14 23:59:22 +10:00
Brett Cannon aa93642a35 Issue #14605: Use None in sys.path_importer_cache to represent no
finder instead of using some (now non-existent) implicit finder.
2012-04-27 15:30:58 -04:00
Brett Cannon e0d88a173c Issue #14605: Make explicit the entries on sys.path_hooks that used to
be implicit.

Added a warning for when sys.path_hooks is found to be empty. Also
changed the meaning of None in sys.path_importer_cache to represent
trying sys.path_hooks again (an interpretation of previous semantics).
Also added a warning for when None was found.

The long-term goal is for None in sys.path_importer_cache to represent
the same as imp.NullImporter: no finder found for that sys.path entry.
2012-04-25 20:54:04 -04:00
Victor Stinner 6c47102982 Issue #12451: runpy: run_path() now opens the Python script in binary mode,
instead of text mode using the locale encoding, to support other encodings than
UTF-8 (scripts using the coding cookie).
2011-07-04 01:45:39 +02:00
Benjamin Peterson 01e3979757 account for the module __dict__ being cleared when its module is 2010-10-13 01:04:36 +00:00
Barry Warsaw 28a691b7fd PEP 3147 2010-04-17 00:19:56 +00:00
R. David Murray 445448ca2d Merged revisions 76934-76935 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76934 | r.david.murray | 2009-12-20 11:24:46 -0500 (Sun, 20 Dec 2009) | 2 lines

  Fix comment typo.
........
  r76935 | r.david.murray | 2009-12-20 11:46:06 -0500 (Sun, 20 Dec 2009) | 10 lines

  Issue #7376: When called with no arguments doctest was running a
  self-test.  Because of a change to the way tracebacks are printed,
  this self-test was failing.  The test is run (and passes) during normal
  regression testing.  So instead of running the failing self-test this
  patch makes doctest emit a usage message.  This is better behavior anyway
  since passing in arguments is the real reason to run doctest as a command.

  Bug discovery and initial patch by Florent Xicluna.
........
2009-12-20 17:28:31 +00:00
Benjamin Peterson e360795dd4 fix test checking for error message 2009-11-25 18:38:11 +00:00
Benjamin Peterson f6489f941c Merged revisions 75264,75268,75293,75318,75391-75392,75436,75478,75971,76003,76058,76140-76141,76231,76380,76428-76429 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75264 | andrew.kuchling | 2009-10-05 17:30:22 -0500 (Mon, 05 Oct 2009) | 1 line

  Add various items
........
  r75268 | andrew.kuchling | 2009-10-05 17:45:39 -0500 (Mon, 05 Oct 2009) | 1 line

  Remove two notes
........
  r75293 | kristjan.jonsson | 2009-10-09 09:32:19 -0500 (Fri, 09 Oct 2009) | 2 lines

  http://bugs.python.org/issue7029
  a non-default timer wasn't actually used by the individual Tests.
........
  r75318 | benjamin.peterson | 2009-10-10 16:15:58 -0500 (Sat, 10 Oct 2009) | 1 line

  remove script which uses long gone module
........
  r75391 | andrew.kuchling | 2009-10-13 10:49:33 -0500 (Tue, 13 Oct 2009) | 1 line

  Link to PEP
........
  r75392 | andrew.kuchling | 2009-10-13 11:11:49 -0500 (Tue, 13 Oct 2009) | 1 line

  Various link, textual, and markup fixes
........
  r75436 | benjamin.peterson | 2009-10-15 10:39:15 -0500 (Thu, 15 Oct 2009) | 1 line

  don't need to mess up sys.path
........
  r75478 | senthil.kumaran | 2009-10-17 20:58:45 -0500 (Sat, 17 Oct 2009) | 3 lines

  Fix a typo.
........
  r75971 | benjamin.peterson | 2009-10-30 22:56:15 -0500 (Fri, 30 Oct 2009) | 1 line

  add some checks for evaluation order with parenthesis #7210
........
  r76003 | antoine.pitrou | 2009-10-31 19:30:13 -0500 (Sat, 31 Oct 2009) | 6 lines

  Hopefully fix the buildbot problems on test_mailbox, by computing
  the maildir toc cache refresh date before actually refreshing the cache.

  (see #6896)
........
  r76058 | benjamin.peterson | 2009-11-02 10:14:19 -0600 (Mon, 02 Nov 2009) | 1 line

  grant list.index() a more informative error message #7252
........
  r76140 | nick.coghlan | 2009-11-07 02:13:55 -0600 (Sat, 07 Nov 2009) | 1 line

  Add test for runpy.run_module package execution and use something other than logging as the example of a non-executable package
........
  r76141 | nick.coghlan | 2009-11-07 02:15:01 -0600 (Sat, 07 Nov 2009) | 1 line

  Some minor cleanups to private runpy code and docstrings
........
  r76231 | benjamin.peterson | 2009-11-12 17:42:23 -0600 (Thu, 12 Nov 2009) | 1 line

  this main is much more useful
........
  r76380 | antoine.pitrou | 2009-11-18 14:20:46 -0600 (Wed, 18 Nov 2009) | 3 lines

  Mention Giampolo R's new FTP TLS support in the what's new file
........
  r76428 | benjamin.peterson | 2009-11-19 20:15:50 -0600 (Thu, 19 Nov 2009) | 1 line

  turn goto into do while loop
........
  r76429 | benjamin.peterson | 2009-11-19 20:56:43 -0600 (Thu, 19 Nov 2009) | 2 lines

  avoid doing an uneeded import in a function
........
2009-11-25 17:46:26 +00:00
Nick Coghlan 260bd3e557 Merged revisions 76286-76287,76289-76294,76296-76299,76301-76305,76307,76310-76311,76313-76322 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76286 | nick.coghlan | 2009-11-15 17:30:34 +1000 (Sun, 15 Nov 2009) | 1 line

  Issue #6816: expose the zipfile and directory execution mechanism to Python code via the runpy module. Also consolidated some script execution functionality in the test harness into a helper module and removed some implementation details from the runpy module documentation.
........
  r76321 | nick.coghlan | 2009-11-16 13:55:51 +1000 (Mon, 16 Nov 2009) | 1 line

  Account for another cache when hunting ref leaks
........
  r76322 | nick.coghlan | 2009-11-16 13:57:32 +1000 (Mon, 16 Nov 2009) | 1 line

  Allow for backslashes in file paths passed to the regex engine
........
2009-11-16 06:49:25 +00:00
Matthias Klose b0a8be5f1b - remove svn:executable property from some library files 2009-06-22 14:17:00 +00:00
Nick Coghlan 3f48ae35c7 Merged revisions 69419-69420 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69419 | nick.coghlan | 2009-02-08 11:26:34 +1000 (Sun, 08 Feb 2009) | 1 line

  Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
........
  r69420 | nick.coghlan | 2009-02-08 11:46:01 +1000 (Sun, 08 Feb 2009) | 1 line

  Mention patch submitter in NEWS entry for r69419
........
2009-02-08 01:58:26 +00:00
Nick Coghlan f088e5e6cc Merged revisions 67750-67751 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67750 | nick.coghlan | 2008-12-14 20:54:50 +1000 (Sun, 14 Dec 2008) | 1 line

  Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details.
........
  r67751 | nick.coghlan | 2008-12-14 21:09:40 +1000 (Sun, 14 Dec 2008) | 1 line

  Add file that was missed from r67750
........
2008-12-14 11:50:48 +00:00
Christian Heimes c3f30c4337 Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60901 | eric.smith | 2008-02-19 14:21:56 +0100 (Tue, 19 Feb 2008) | 1 line

  Added PEP 3101.
........
  r60907 | georg.brandl | 2008-02-20 20:12:36 +0100 (Wed, 20 Feb 2008) | 2 lines

  Fixes contributed by Ori Avtalion.
........
  r60909 | eric.smith | 2008-02-21 00:34:22 +0100 (Thu, 21 Feb 2008) | 1 line

  Trim leading zeros from a floating point exponent, per C99.  See issue 1600.  As far as I know, this only affects Windows.  Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description).
........
  r60910 | eric.smith | 2008-02-21 00:39:28 +0100 (Thu, 21 Feb 2008) | 1 line

  Now that PyOS_ascii_formatd supports the 'n' format, simplify the float formatting code to just call it.
........
  r60918 | andrew.kuchling | 2008-02-21 15:23:38 +0100 (Thu, 21 Feb 2008) | 2 lines

  Close manifest file.
  This change doesn't make any difference to CPython, but is a necessary fix for Jython.
........
  r60921 | guido.van.rossum | 2008-02-21 18:46:16 +0100 (Thu, 21 Feb 2008) | 2 lines

  Remove news about float repr() -- issue 1580 is still in limbo.
........
  r60923 | guido.van.rossum | 2008-02-21 19:18:37 +0100 (Thu, 21 Feb 2008) | 5 lines

  Removed uses of dict.has_key() from distutils, and uses of
  callable() from copy_reg.py, so the interpreter now starts up
  without warnings when '-3' is given.  More work like this needs to
  be done in the rest of the stdlib.
........
  r60924 | thomas.heller | 2008-02-21 19:28:48 +0100 (Thu, 21 Feb 2008) | 4 lines

  configure.ac: Remove the configure check for _Bool, it is already done in the
  top-level Python configure script.
  configure, fficonfig.h.in: regenerated.
........
  r60925 | thomas.heller | 2008-02-21 19:52:20 +0100 (Thu, 21 Feb 2008) | 3 lines

  Replace 'has_key()' with 'in'.
  Replace 'raise Error, stuff' with 'raise Error(stuff)'.
........
  r60927 | raymond.hettinger | 2008-02-21 20:24:53 +0100 (Thu, 21 Feb 2008) | 1 line

  Update more instances of has_key().
........
  r60928 | guido.van.rossum | 2008-02-21 20:46:35 +0100 (Thu, 21 Feb 2008) | 3 lines

  Fix a few typos and layout glitches (more work is needed).
  Move 2.5 news to Misc/HISTORY.
........
  r60936 | georg.brandl | 2008-02-21 21:33:38 +0100 (Thu, 21 Feb 2008) | 2 lines

  #2079: typo in userdict docs.
........
  r60938 | georg.brandl | 2008-02-21 21:38:13 +0100 (Thu, 21 Feb 2008) | 2 lines

  Part of #2154: minimal syntax fixes in doc example snippets.
........
  r60942 | raymond.hettinger | 2008-02-22 04:16:42 +0100 (Fri, 22 Feb 2008) | 1 line

  First draft for itertools.product().  Docs and other updates forthcoming.
........
  r60955 | nick.coghlan | 2008-02-22 11:54:06 +0100 (Fri, 22 Feb 2008) | 1 line

  Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery)
........
  r60956 | georg.brandl | 2008-02-22 13:31:45 +0100 (Fri, 22 Feb 2008) | 2 lines

  A lot more typo fixes by Ori Avtalion.
........
  r60957 | georg.brandl | 2008-02-22 13:56:34 +0100 (Fri, 22 Feb 2008) | 2 lines

  Don't reference pyshell.
........
  r60958 | georg.brandl | 2008-02-22 13:57:05 +0100 (Fri, 22 Feb 2008) | 2 lines

  Another fix.
........
2008-02-22 16:37:40 +00:00
Christian Heimes cbf3b5cb76 Merged revisions 59275-59303 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NOTE: The merge does NOT contain the modified file Python/import.c from
      r59288. I can't get it running. Nick, please check in the PEP 366
      manually.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

........
  r59279 | georg.brandl | 2007-12-02 19:17:50 +0100 (Sun, 02 Dec 2007) | 2 lines

  Fix a sentence I missed before. Do not merge to 3k.
........
  r59281 | georg.brandl | 2007-12-02 22:58:54 +0100 (Sun, 02 Dec 2007) | 3 lines

  Add documentation for PySys_* functions.
  Written by Charlie Shepherd for GHOP. Also fixes #1245.
........
  r59288 | nick.coghlan | 2007-12-03 13:55:17 +0100 (Mon, 03 Dec 2007) | 1 line

  Implement PEP 366
........
  r59290 | christian.heimes | 2007-12-03 14:47:29 +0100 (Mon, 03 Dec 2007) | 3 lines

  Applied my patch #1455 with some extra fixes for VS 2005
  The new msvc9compiler module supports VS 2005 and VS 2008. I've also fixed build_ext to support PCbuild8 and PCbuild9 and backported my fix for xxmodule.c from py3k. The old code msvccompiler is still in place in case somebody likes to build an extension with VS 2003 or earlier.
  I've also updated the cygwin compiler module for VS 2005 and VS 2008. It works with VS 2005 but I'm unable to test it with VS 2008. We have to wait for a new version of cygwin.
........
  r59291 | christian.heimes | 2007-12-03 14:55:16 +0100 (Mon, 03 Dec 2007) | 1 line

  Added comment to Misc/NEWS for r59290
........
  r59292 | christian.heimes | 2007-12-03 15:28:04 +0100 (Mon, 03 Dec 2007) | 1 line

  I followed MA Lemberg's suggestion and added comments to the late initialization of the type slots.
........
  r59293 | facundo.batista | 2007-12-03 17:29:52 +0100 (Mon, 03 Dec 2007) | 3 lines


  Speedup and cleaning of __str__.  Thanks Mark Dickinson.
........
  r59294 | facundo.batista | 2007-12-03 18:55:00 +0100 (Mon, 03 Dec 2007) | 4 lines


  Faster _fix function, and some reordering for a more elegant
  coding. Thanks Mark Dickinson.
........
  r59295 | martin.v.loewis | 2007-12-03 20:20:02 +0100 (Mon, 03 Dec 2007) | 5 lines

  Issue #1727780: Support loading pickles of random.Random objects created
  on 32-bit systems on 64-bit systems, and vice versa. As a consequence
  of the change, Random pickles created by Python 2.6 cannot be loaded
  in Python 2.5.
........
  r59297 | facundo.batista | 2007-12-03 20:49:54 +0100 (Mon, 03 Dec 2007) | 3 lines


  Two small fixes. Issue 1547.
........
  r59299 | georg.brandl | 2007-12-03 20:57:02 +0100 (Mon, 03 Dec 2007) | 2 lines

  #1548: fix apostroph placement.
........
  r59300 | christian.heimes | 2007-12-03 21:01:02 +0100 (Mon, 03 Dec 2007) | 3 lines

  Patch #1537 from Chad Austin
  Change GeneratorExit's base class from Exception to BaseException
  (This time I'm applying the patch to the correct sandbox.)
........
  r59302 | georg.brandl | 2007-12-03 21:03:46 +0100 (Mon, 03 Dec 2007) | 3 lines

  Add examples to the xmlrpclib docs.
  Written for GHOP by Josip Dzolonga.
........
2007-12-03 21:02:03 +00:00
Thomas Wouters ed03b4121e Merge the trunk changes in. Breaks socket.ssl for now.
Merged revisions 57392-57619 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines

  Bug #1011: fix rfc822.Message.getheader docs.
........
  r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines

  Patch #1006: port test_winreg to unittest.
........
  r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines

  Fix #1012: wrong URL to :mod:`site` in install/index.rst.
........
  r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines

  Patch #1008: port test_signal to unittest.
........
  r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines

  Port test_frozen to unittest.
........
  r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines

  Document new utility functions in test_support.
........
  r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines

  Remove test_rgbimg output file, there is no test_rgbimg.py.
........
  r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines

  Remove output file for test_ossaudiodev, also properly close the dsp object.
........
  r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines

  Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev.
........
  r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line

  Convert test_pkg to use unittest.
........
  r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines

  Catch the correct errors.
........
  r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines

  Port test_class to unittest. Patch #1671298.
........
  r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line

  Make test_structmembers pass when run with regrtests's -R flag.
........
  r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line

  Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon)
........
  r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line

  Revert compile.c changes that shouldn't have been included in previous checkin
........
  r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line

  Fix bug 1764407 - the -i switch now does the right thing when using the -m switch
........
  r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines

  Server-side SSL and certificate validation, by Bill Janssen.
  While cleaning up Bill's C style, I may have cleaned up some code
  he didn't touch as well (in _ssl.c).
........
  r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines

  Try to get this to build with Visual Studio by moving all the variable
  declarations to the beginning of a scope.
........
  r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line

  Fix test so it is skipped properly if there is no SSL support.
........
  r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines

  Fix a few more variables to try to get this to compile with Visual Studio.
........
  r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line

  Try to get this test to pass for systems that do not have SO_REUSEPORT
........
  r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines

  keep setup.py from listing unneeded hash modules (_md5, _sha*) as
  missing when they were not built because _hashlib with openssl provided
  their functionality instead.

  don't build bsddb185 if bsddb was built.
........
  r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line

  Fix typo in docstring (missing c in reacquire)
........
  r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines

  Spell check (also americanify behaviour, it's almost 3 times as common)
........
  r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines

  Reap children before the test starts so hopefully SocketServer
  won't find any old children left around which causes an exception
  in collect_children() and the test to fail.
........
  r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line

  Fail gracefully if the cert files cannot be created
........
  r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines

  Bill Janssen wrote:
  Here's a patch which makes test_ssl a better player in the buildbots
  environment.  I deep-ended on "try-except-else" clauses.
........
  r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line

  Get the test passing by commenting out some writes (should they be removed?)
........
  r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines

  Catch IOError for when the device file doesn't exist or the user doesn't have
  permission to write to the device.
........
  r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines

  Another patch from Bill Janssen that:
  1)  Fixes the bug that two class names are initial-lower-case.
  2)  Replaces the poll waiting for the server to become ready with
      a threading.Event signal.
........
  r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line

  Stop using string.join (from the module) to ease upgrade to py3k
........
  r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line

  Make a utility function for handling (printing) an error
........
  r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines

  If we can't create a certificate, print a warning, but don't fail the test.
  Modified patch from what Bill Janssen sent on python-3000.
........
  r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines


  Ignore test failures caused by 'resource temporarily unavailable'
  exceptions raised in the test server thread, since SimpleXMLRPCServer
  does not gracefully handle them.  Changed number of requests handled
  by tests server thread to one (was 2) because no tests require more
  than one request. [GSoC - Alan McIntyre]
........
  r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines

  > Regardless, building a fixed test certificate and checking it in sounds like
  > the better option.  Then the openssl command in the test code can be turned
  > into a comment describing how the test data was pregenerated.

  Here's a patch that does that.

  Bill
........
  r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines

  > Some of the code sets the error string in this directly before
  > returning NULL, and other pieces of the code call PySSL_SetError,
  > which creates the error string.  I think some of the places which set
  > the string directly probably shouldn't; instead, they should call
  > PySSL_SetError to cons up the error name directly from the err code.
  > However, PySSL_SetError only works after the construction of an ssl
  > object, which means it can't be used there...  I'll take a longer look
  > at it and see if there's a reasonable fix.

  Here's a patch which addresses this.  It also fixes the indentation in
  PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning
  about one of the OpenSSL macros, and makes the namespace a bit more
  consistent.  I've tested it on FC 7 and OS X 10.4.

  % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl
  test_ssl
  beginning 6 repetitions
  123456
  ......
  1 test OK.
  [29244 refs]
  %

  [GvR: slightly edited to enforce 79-char line length, even if it required
   violating the style guide.]
........
  r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines

  Patch 10124 by Bill Janssen, docs for the new ssl code.
........
  r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines

  Patch # 1739906 by Christian Heimes -- add reduce to functools (importing
  it from __builtin__).
........
  r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines

  News about functools.reduce.
........
  r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines

  Document rev. 57574.
........
  r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines

  Adding basic imputil documentation.
........
  r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines

  Fix some glitches.
........
  r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines

  TarFile.__init__() no longer fails if no name argument is passed and
  the fileobj argument has no usable name attribute (e.g. StringIO).

  (will backport to 2.5)
........
  r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines


  Improve extended slicing support in builtin types and classes. Specifically:

   - Specialcase extended slices that amount to a shallow copy the same way as
     is done for simple slices, in the tuple, string and unicode case.

   - Specialcase step-1 extended slices to optimize the common case for all
     involved types.

   - For lists, allow extended slice assignment of differing lengths as long
     as the step is 1. (Previously, 'l[:2:1] = []' failed even though
     'l[:2] = []' and 'l[:2:None] = []' do not.)

   - Implement extended slicing for buffer, array, structseq, mmap and
     UserString.UserString.

   - Implement slice-object support (but not non-step-1 slice assignment) for
     UserString.MutableString.

   - Add tests for all new functionality.
........
2007-08-28 21:37:11 +00:00
Guido van Rossum 806c2469cb Merged revisions 56753-56781 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

................
  r56760 | neal.norwitz | 2007-08-05 18:55:39 -0700 (Sun, 05 Aug 2007) | 178 lines

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

  ........
    r56485 | facundo.batista | 2007-07-21 17:13:00 -0700 (Sat, 21 Jul 2007) | 5 lines


    Selectively enable tests for asyncore.readwrite based on the presence
    of poll support in the select module (since this is the only case in
    which readwrite can be called). [GSoC - Alan McIntyre]
  ........
    r56488 | nick.coghlan | 2007-07-22 03:18:07 -0700 (Sun, 22 Jul 2007) | 1 line

    Add explicit relative import tests for runpy.run_module
  ........
    r56509 | nick.coghlan | 2007-07-23 06:41:45 -0700 (Mon, 23 Jul 2007) | 5 lines

    Correctly cleanup sys.modules after executing runpy relative import
    tests
    Restore Python 2.4 ImportError when attempting to execute a package
    (as imports cannot be guaranteed to work properly if you try it)
  ........
    r56519 | nick.coghlan | 2007-07-24 06:07:38 -0700 (Tue, 24 Jul 2007) | 1 line

    Tweak runpy test to do a better job of confirming that sys has been manipulated correctly
  ........
    r56520 | nick.coghlan | 2007-07-24 06:58:28 -0700 (Tue, 24 Jul 2007) | 1 line

    Fix an incompatibility between the -i and -m command line switches as reported on python-dev by PJE - runpy.run_module now leaves any changes it makes to the sys module intact after the function terminates
  ........
    r56523 | nick.coghlan | 2007-07-24 07:39:23 -0700 (Tue, 24 Jul 2007) | 1 line

    Try to get rid of spurious failure in test_resource on the Debian buildbots by changing the file size limit before attempting to close the file
  ........
    r56533 | facundo.batista | 2007-07-24 14:20:42 -0700 (Tue, 24 Jul 2007) | 7 lines


    New tests for basic behavior of smtplib.SMTP and
    smtpd.DebuggingServer. Change to use global host & port number
    variables. Modified the 'server' to take a string to send back in
    order to vary test server responses. Added a test for the reaction of
    smtplib.SMTP to a non-200 HELO response. [GSoC - Alan McIntyre]
  ........
    r56538 | nick.coghlan | 2007-07-25 05:57:48 -0700 (Wed, 25 Jul 2007) | 1 line

    More buildbot cleanup - let the OS assign the port for test_urllib2_localnet
  ........
    r56539 | nick.coghlan | 2007-07-25 06:18:58 -0700 (Wed, 25 Jul 2007) | 1 line

    Add a temporary diagnostic message before a strange failure on the alpha Debian buildbot
  ........
    r56543 | martin.v.loewis | 2007-07-25 09:24:23 -0700 (Wed, 25 Jul 2007) | 2 lines

    Change location of the package index to pypi.python.org/pypi
  ........
    r56551 | georg.brandl | 2007-07-26 02:36:25 -0700 (Thu, 26 Jul 2007) | 2 lines

    tabs, newlines and crs are valid XML characters.
  ........
    r56553 | nick.coghlan | 2007-07-26 07:03:00 -0700 (Thu, 26 Jul 2007) | 1 line

    Add explicit test for a misbehaving math.floor
  ........
    r56561 | mark.hammond | 2007-07-26 21:52:32 -0700 (Thu, 26 Jul 2007) | 3 lines

    In consultation with Kristjan Jonsson, only define WINVER and _WINNT_WIN32
    if (a) we are building Python itself and (b) no one previously defined them
  ........
    r56562 | mark.hammond | 2007-07-26 22:08:54 -0700 (Thu, 26 Jul 2007) | 2 lines

    Correctly detect AMD64 architecture on VC2003
  ........
    r56566 | nick.coghlan | 2007-07-27 03:36:30 -0700 (Fri, 27 Jul 2007) | 1 line

    Make test_math error messages more meaningful for small discrepancies in results
  ........
    r56588 | martin.v.loewis | 2007-07-27 11:28:22 -0700 (Fri, 27 Jul 2007) | 2 lines

    Bug #978833: Close https sockets by releasing the _ssl object.
  ........
    r56601 | martin.v.loewis | 2007-07-28 00:03:05 -0700 (Sat, 28 Jul 2007) | 3 lines

    Bug #1704793: Return UTF-16 pair if unicodedata.lookup cannot
    represent the result in a single character.
  ........
    r56604 | facundo.batista | 2007-07-28 07:21:22 -0700 (Sat, 28 Jul 2007) | 9 lines


    Moved all of the capture_server socket setup code into the try block
    so that the event gets set if a failure occurs during server setup
    (otherwise the test will block forever).  Changed to let the OS assign
    the server port number, and client side of test waits for port number
    assignment before proceeding. The test data in DispatcherWithSendTests
    is also sent in multiple send() calls instead of one to make sure this
    works properly. [GSoC - Alan McIntyre]
  ........
    r56611 | georg.brandl | 2007-07-29 01:26:10 -0700 (Sun, 29 Jul 2007) | 2 lines

    Clarify PEP 343 description.
  ........
    r56614 | georg.brandl | 2007-07-29 02:11:15 -0700 (Sun, 29 Jul 2007) | 2 lines

    try-except-finally is new in 2.5.
  ........
    r56617 | facundo.batista | 2007-07-29 07:23:08 -0700 (Sun, 29 Jul 2007) | 9 lines


    Added tests for asynchat classes simple_producer & fifo, and the
    find_prefix_at_end function. Check behavior of a string given as a
    producer.  Added tests for behavior of asynchat.async_chat when given
    int, long, and None terminator arguments. Added usepoll attribute to
    TestAsynchat to allow running the asynchat tests with poll support
    chosen whether it's available or not (improves coverage of asyncore
    code). [GSoC - Alan McIntyre]
  ........
    r56620 | georg.brandl | 2007-07-29 10:38:35 -0700 (Sun, 29 Jul 2007) | 2 lines

    Bug #1763149: use proper slice syntax in docstring.
     (backport)
  ........
    r56624 | mark.hammond | 2007-07-29 17:45:29 -0700 (Sun, 29 Jul 2007) | 4 lines

    Correct use of Py_BUILD_CORE - now make sure it is defined before it is
    referenced, and also fix definition of _WIN32_WINNT.
    Resolves patch 1761803.
  ........
    r56632 | facundo.batista | 2007-07-30 20:03:34 -0700 (Mon, 30 Jul 2007) | 8 lines


    When running asynchat tests on OS X (darwin), the test client now
    overrides asyncore.dispatcher.handle_expt to do nothing, since
    select.poll gives a POLLHUP error at the completion of these tests.
    Added timeout & count arguments to several asyncore.loop calls to
    avoid the possibility of a test hanging up a build. [GSoC - Alan
    McIntyre]
  ........
    r56633 | nick.coghlan | 2007-07-31 06:38:01 -0700 (Tue, 31 Jul 2007) | 1 line

    Eliminate RLock race condition reported in SF bug #1764059
  ........
    r56636 | martin.v.loewis | 2007-07-31 12:57:56 -0700 (Tue, 31 Jul 2007) | 2 lines

    Define _BSD_SOURCE, to get access to POSIX extensions on OpenBSD 4.1+.
  ........
    r56653 | facundo.batista | 2007-08-01 16:18:36 -0700 (Wed, 01 Aug 2007) | 9 lines


    Allow the OS to select a free port for each test server. For
    DebuggingServerTests, construct SMTP objects with a localhost argument
    to avoid abysmally long FQDN lookups (not relevant to items under
    test) on some machines that would cause the test to fail. Moved server
    setup code in the server function inside the try block to avoid the
    possibility of setup failure hanging the test.  Minor edits to conform
    to PEP 8. [GSoC - Alan McIntyre]
  ........
    r56681 | matthias.klose | 2007-08-02 14:33:13 -0700 (Thu, 02 Aug 2007) | 2 lines

    - Allow Emacs 22 for building the documentation in info format.
  ........
    r56689 | neal.norwitz | 2007-08-02 23:46:29 -0700 (Thu, 02 Aug 2007) | 1 line

    Py_ssize_t is defined regardless of HAVE_LONG_LONG.  Will backport
  ........
    r56727 | hyeshik.chang | 2007-08-03 21:10:18 -0700 (Fri, 03 Aug 2007) | 3 lines

    Fix gb18030 codec's bug that doesn't map two-byte characters on
    GB18030 extension in encoding. (bug reported by Bjorn Stabell)
  ........
    r56751 | neal.norwitz | 2007-08-04 20:23:31 -0700 (Sat, 04 Aug 2007) | 7 lines

    Handle errors when generating a warning.
    The value is always written to the returned pointer if getting it was
    successful, even if a warning causes an error. (This probably doesn't matter
    as the caller will probably discard the value.)

    Will backport.
  ........
................
2007-08-06 23:33:07 +00:00
Guido van Rossum be19ed77dd Fix most trivially-findable print statements.
There's one major and one minor category still unfixed:
doctests are the major category (and I hope to be able to augment the
refactoring tool to refactor bona fide doctests soon);
other code generating print statements in strings is the minor category.

(Oh, and I don't know if the compiler package works.)
2007-02-09 05:37:30 +00:00
Georg Brandl 7cae87ca7b Patch #1550800: make exec a function. 2006-09-06 06:51:57 +00:00
Thomas Wouters 49fd7fa443 Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html

Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:

test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec

This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.
2006-04-21 10:40:58 +00:00
Thomas Wouters a977329b6f Merge part of the trunk changes into the p3yk branch. This merges from 43030
(branch-creation time) up to 43067. 43068 and 43069 contain a little
swapping action between re.py and sre.py, and this mightily confuses svn
merge, so later changes are going in separately.

This merge should break no additional tests.

The last-merged revision is going in a 'last_merge' property on '.' (the
branch directory.) Arbitrarily chosen, really; if there's a BCP for this, I
couldn't find it, but we can easily change it afterwards ;)
2006-04-21 09:43:23 +00:00