Commit Graph

220 Commits

Author SHA1 Message Date
Gregory P. Smith 14b04cd350 Plug a leak in timemodule. The module dictionary is saved during
initialization. If the interpreter is shut down and reinitialized (embedded
CPython), the old module dictionary was not dec-refed during the next import of
the time extension module.

Contributed by Torsten Marek of Google.
2012-11-27 10:16:55 -08:00
Stefan Krah 2201ecbbfc Issue #14125: backport refleak fix (d4adbf908983). 2012-02-27 17:34:17 +01:00
Victor Stinner 136ea49b39 Issue #10951: Fix a compiler warning in timemodule.c 2011-12-17 22:37:18 +01:00
Antoine Pitrou c345ce1a69 Issue #10350: Read and save errno before calling a function which might overwrite it.
Original patch by Hallvard B Furuseth.
2011-12-16 12:28:32 +01:00
Victor Stinner 720f34a3e8 Issue #5905: time.strftime() is now using the locale encoding, instead of
UTF-8, if the wcsftime() function is not available.
2011-12-09 20:19:24 +01:00
Victor Stinner 8d91d454d5 Issue #10653: Fix time.strftime() on Windows, check for invalid format strings 2011-10-16 23:45:39 +02:00
Victor Stinner c1f32ca0ad Issue #10653: On Windows, use strftime() instead of wcsftime() because
wcsftime() doesn't format time zone correctly.
2011-10-14 02:36:13 +02:00
Senthil Kumaran ae664fb528 Merge from 3.1 2011-04-06 14:11:09 +08:00
Senthil Kumaran 8f377a3bbe Issue #10762: Guard against invalid/non-supported format string '%f' on Windows. Patch Santoso Wijaya. 2011-04-06 12:54:06 +08:00
Victor Stinner 6f0e4f99ab time.strftime(): replace PyErr_Format() by PyErr_SetString()
The argument was not used in the format string.
2011-03-21 02:14:53 +01:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Alexander Belopolsky 4fb96f41f4 Merged revisions 87919 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87919 | alexander.belopolsky | 2011-01-10 20:21:25 -0500 (Mon, 10 Jan 2011) | 4 lines

  Issue #1726687: time.mktime() will now correctly compute value one
  second before epoch.  Original patch by Peter Wang, reported by Martin
  Blais.
........
2011-02-15 15:40:59 +00:00
R. David Murray 43b2f457a0 Merged revisions 87136,87221,87256,87337-87338,87571,87839,88164 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k


........
  r87136 | r.david.murray | 2010-12-08 17:53:00 -0500 (Wed, 08 Dec 2010) | 6 lines

  Have script_helper._assert_python strip refcount strings from stderr.

  This makes the output of the function and those that depend on it
  independent of whether or not they are being run under a debug
  build.
........
  r87221 | r.david.murray | 2010-12-13 19:55:46 -0500 (Mon, 13 Dec 2010) | 4 lines

  #10699: fix docstring for tzset: it does not take a parameter

  Thanks to Garrett Cooper for the fix.
........
  r87256 | r.david.murray | 2010-12-14 21:19:14 -0500 (Tue, 14 Dec 2010) | 2 lines

  #10705: document what the values of debuglevel are and mean.
........
  r87337 | r.david.murray | 2010-12-17 11:11:40 -0500 (Fri, 17 Dec 2010) | 2 lines

  #10559: provide instructions for accessing sys.argv when first mentioned.
........
  r87338 | r.david.murray | 2010-12-17 11:29:07 -0500 (Fri, 17 Dec 2010) | 2 lines

  #10454: clarify the compileall docs and help messages.
    [compileall.py changes not backported.]
........
  r87571 | r.david.murray | 2010-12-29 14:06:48 -0500 (Wed, 29 Dec 2010) | 2 lines

  Fix same typo in docs.
........
  r87839 | r.david.murray | 2011-01-07 16:57:25 -0500 (Fri, 07 Jan 2011) | 9 lines

  Fix formatting of values with embedded newlines when rfc2047 encoding

  Before this patch if a value being encoded had an embedded newline,
  the line following the newline would have no leading whitespace,
  and the whitespace it did have was encoded into the word.  Now
  the existing whitespace gets turned into a blank, the way it does
  in other header reformatting, and the _continuation_ws gets added
  at the beginning of the encoded line.
........
  r88164 | r.david.murray | 2011-01-24 14:34:58 -0500 (Mon, 24 Jan 2011) | 12 lines

  #10960: fix 'stat' links, link to lstat from stat, general tidy of stat doc.

  Original patch by Michal Nowikowski, with some additions and wording
  fixes by me.

  I changed the wording from 'Performs a stat system call' to 'Performs
  the equivalent of a stat system call', since on Windows there are no
  stat/lstat system calls involved.  I also extended Michal's breakout
  of the attributes into a list to the other paragraphs, and rearranged
  the order of the paragraphs in the 'stat' docs to make it flow
  better and put it in what I think is a more logical/useful order.
........
2011-02-11 03:13:19 +00:00
Alexander Belopolsky b7d40d1702 Issue #1726687: time.mktime() will now correctly compute value one
second before epoch.  Original patch by Peter Wang, reported by Martin
Blais.
2011-01-11 01:21:25 +00:00
Victor Stinner 06ec45e2f8 Issue #10864: limit year to [1; 9999] for strftime() on Solaris 2011-01-08 03:35:36 +00:00
Victor Stinner 301f1217ac Issue #1777412: Remove all limits on tm_year from time.strftime()
The buildbots will tell us which platform does support or not negative years.
2011-01-08 03:06:52 +00:00
Victor Stinner 73ea29cb03 Issue #1777412: strftime() accepts year >= 1 instead of year >= 1900
* With Visual Studio, year have to be in [1; 9999]
 * Add more tests on the year field
2011-01-08 01:56:31 +00:00
Alexander Belopolsky 0dd06f4082 Fixed error handling branches. Thanks
Victor Stinner for pointing this out.
2011-01-08 01:23:02 +00:00
Alexander Belopolsky b8bb4664fc Issue #1777412: extended year range of strftime down to 1000. 2011-01-08 00:13:34 +00:00
Alexander Belopolsky c64708ae48 Issue #10827: Changed the rules for 2-digit years. The time.asctime
function will now format any year when time.accept2dyear is false and
will accept years >= 1000 otherwise.  The year range accepted by
time.mktime and time.strftime is still system dependent, but
time.mktime will now accept full range supported by the OS. Conversion
of 2-digit years to 4-digit is deprecated.
2011-01-07 19:59:19 +00:00
Alexander Belopolsky 610e544bf7 Further simplify gettmarg() 2011-01-06 21:57:06 +00:00
Alexander Belopolsky ecbb8dc17a Use PyOS_snprintf for better portability. 2011-01-06 16:45:25 +00:00
Alexander Belopolsky a686725859 - time.accept2dyear = True is now equivalent to time.accept2dyear = 1
- removed unnecessary struct_time to tuple conversion
- added more unit tests
(See issue #10827 for discussion.)
2011-01-05 23:00:47 +00:00
Alexander Belopolsky 5da468f94a Whitespace cleanup 2011-01-04 17:15:52 +00:00
Alexander Belopolsky b9588b528a Issue #8013: time.asctime and time.ctime no longer call system asctime
and ctime functions.  The year range for time.asctime is now 1900
through maxint.  The range for time.ctime is the same as for
time.localtime.  The string produced by these functions is longer than
24 characters when year is greater than 9999.
2011-01-04 16:34:30 +00:00
Alexander Belopolsky d4bf48bbb3 Merged revisions 87648,87656 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87648 | alexander.belopolsky | 2011-01-02 15:48:22 -0500 (Sun, 02 Jan 2011) | 1 line

  Issue #8013: Fixed time.asctime segfault when OS's asctime fails
........
  r87656 | alexander.belopolsky | 2011-01-02 17:16:10 -0500 (Sun, 02 Jan 2011) | 1 line

  Issue #8013: Fixed test
........
2011-01-02 23:09:41 +00:00
Georg Brandl e10608cf5d #8013 follow-up:
* In asctime and ctime, properly remove the newline if the year has more than four digits
* Consistent error message for both functions
* Fix the test comments and add a check for the removed newline
2011-01-02 22:33:43 +00:00
Alexander Belopolsky e2dc082294 Issue #8013: Fixed time.asctime segfault when OS's asctime fails 2011-01-02 20:48:22 +00:00
R. David Murray 4d55bf9fcc #10699: fix docstring for tzset: it does not take a parameter
Thanks to Garrett Cooper for the fix.
2010-12-14 00:55:46 +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 beb4135b8c PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*
All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the
prototype for the new function PyUnicode_AsWideCharString().
2010-10-07 01:02:42 +00:00
Victor Stinner ef12810f0c time: fix gcc warning
* Create format_arg variable to use the right types
 * Strip trailing spaces
2010-10-07 01:00:52 +00:00
Alexander Belopolsky 38e2996152 Issue #6608: time.asctime is now checking struct tm fields its input
before passing it to the system asctime.  Patch by MunSic Jeong.
2010-10-01 14:18:49 +00:00
Victor Stinner b29047876d Issue #9979: Use PyUnicode_AsWideCharString() in time.strftime()
Allocate memory with PyMem_Alloc() instead of the PyBytes API. Prepare the
surrogates support.
2010-09-29 10:34:19 +00:00
Alexander Belopolsky 6fc4ade2bb Issue #9079: Added _PyTime_gettimeofday(_PyTime_timeval *tp) to C API
exposed in Python.h.  This function is similar to POSIX
gettimeofday(struct timeval *tp), but available on platforms without
gettimeofday().
2010-08-05 17:34:27 +00:00
Alexander Belopolsky d95a586d77 Issue #9012: "Separate compilation of time and datetime modules."
Segregated code shared between time and datetime modules into
Modules/_time.c.  Added a new header file, Modules/_time.h, which
will be used instead of Include/timefuncs.h for declarations shared
between time and datetime modules.
2010-06-16 22:38:15 +00:00
Alexander Belopolsky 69f3fd000d Merged revisions 81756 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81756 | alexander.belopolsky | 2010-06-05 10:54:26 -0400 (Sat, 05 Jun 2010) | 1 line

  Issue #8899: time.struct_time now has class and atribute docstrings.
........
2010-06-05 15:04:51 +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
Antoine Pitrou dc8c2adad6 Poor PLAN9, it isn't supported 2010-02-22 19:41:37 +00:00
Brett Cannon ec79b1ca21 Merged revisions 75020 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75020 | brett.cannon | 2009-09-22 12:13:27 -0700 (Tue, 22 Sep 2009) | 1 line

  Fix whitespace.
........
2009-09-22 19:15:35 +00:00
Brett Cannon 7d12c559ce Merged revisions 75011 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75011 | brett.cannon | 2009-09-21 17:29:48 -0700 (Mon, 21 Sep 2009) | 10 lines

  When range checking was added to time.strftime() a check was placed on tm_isdst
  to make sure it fell within [-1, 1] just in case someone implementing
  strftime() in libc was stupid enough to assume this. Turns out, though, some
  OSs (e.g. zOS) are stupid enough to use values outside of this range for time
  structs created by the system itself. So instead of throwing a ValueError,
  tm_isdst is now normalized before being passed to strftime().

  Fixes issue #6823. Thanks Robert Shapiro for diagnosing the problem and
  contributing an initial patch.
........
2009-09-22 00:32:59 +00:00
Hirokazu Yamamoto 6b0e51a08c Issue #6183: Disables wcsftime on VC6. 2009-06-03 05:19:18 +00:00
Martin v. Löwis 1b01ccd76a Issue #5562: Use wcsftime for time.strftime where available. 2009-05-30 06:13:40 +00:00
Amaury Forgeot d'Arc b5be6d4819 re-merge r69268 (issue4804) from trunk:
Now that the C runtime assertions are not silenced any more,
we must provide checks for the format string of strftime
2009-03-02 23:52:57 +00:00
Hirokazu Yamamoto 575d133065 Issue #5249: time.strftime returned malformed string when format string
contained non ascii character on windows.
2009-02-16 09:13:20 +00:00
Marc-André Lemburg 4cc0f24857 Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.

We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.
2008-08-07 18:54:33 +00:00
Georg Brandl 86b2fb9d77 Merged revisions 64623,64640,64665,64687,64689-64690,64719,64721,64735,64742,64744-64746,64756-64761,64767-64769,64771-64772,64774-64775,64788,64793,64835-64836 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64623 | benjamin.peterson | 2008-07-01 21:51:54 +0200 (Tue, 01 Jul 2008) | 1 line

  write a short little section for multiprocessing; it still needs help
........
  r64640 | georg.brandl | 2008-07-01 22:56:03 +0200 (Tue, 01 Jul 2008) | 2 lines

  Add a comment about incref'ing w.
........
  r64665 | jesse.noller | 2008-07-02 18:56:51 +0200 (Wed, 02 Jul 2008) | 1 line

  Add #!/usr/bin/env python for ben
........
  r64687 | andrew.kuchling | 2008-07-03 14:50:03 +0200 (Thu, 03 Jul 2008) | 1 line

  Tweak wording
........
  r64689 | benjamin.peterson | 2008-07-03 14:57:35 +0200 (Thu, 03 Jul 2008) | 1 line

  lowercase glossary term
........
  r64690 | benjamin.peterson | 2008-07-03 15:01:17 +0200 (Thu, 03 Jul 2008) | 1 line

  let the term be linked
........
  r64719 | raymond.hettinger | 2008-07-05 04:11:55 +0200 (Sat, 05 Jul 2008) | 1 line

  Update comment on prediction macros.
........
  r64721 | georg.brandl | 2008-07-05 12:07:18 +0200 (Sat, 05 Jul 2008) | 2 lines

  Fix tabs.
........
  r64735 | mark.dickinson | 2008-07-05 17:25:48 +0200 (Sat, 05 Jul 2008) | 3 lines

  Minor rewrite of cmath_log to work around a Sun compiler bug.  See issue
  #3168.
........
  r64742 | benjamin.peterson | 2008-07-05 18:29:38 +0200 (Sat, 05 Jul 2008) | 1 line

  make regrtest aware of the lib2to3 resource
........
  r64744 | georg.brandl | 2008-07-05 18:43:45 +0200 (Sat, 05 Jul 2008) | 2 lines

  Keep below 80 chars.
........
  r64745 | facundo.batista | 2008-07-05 21:19:50 +0200 (Sat, 05 Jul 2008) | 3 lines


  Issue 3289.  Removed two lines that ended doing nothing.
........
  r64746 | facundo.batista | 2008-07-05 22:39:59 +0200 (Sat, 05 Jul 2008) | 4 lines


  Issue #3239. Differentiate the ascii call from the curses one and
  the builtin one.
........
  r64756 | gregory.p.smith | 2008-07-06 09:16:40 +0200 (Sun, 06 Jul 2008) | 3 lines

  - Issue #2113: Fix error in subprocess.Popen if the select system call is
    interrupted by a signal.
........
  r64757 | benjamin.peterson | 2008-07-06 14:39:09 +0200 (Sun, 06 Jul 2008) | 1 line

  remove test_compact_freelists from test_sys
........
  r64758 | gregory.p.smith | 2008-07-06 19:06:29 +0200 (Sun, 06 Jul 2008) | 2 lines

  fix issue3304 - remove an incorrect PyMem_Free in fileio_init
........
  r64759 | georg.brandl | 2008-07-06 19:36:20 +0200 (Sun, 06 Jul 2008) | 2 lines

  Fix opensearch template.
........
  r64760 | andrew.kuchling | 2008-07-06 19:43:16 +0200 (Sun, 06 Jul 2008) | 1 line

  Wording fix
........
  r64761 | andrew.kuchling | 2008-07-06 19:44:17 +0200 (Sun, 06 Jul 2008) | 1 line

  Add two items; rewrap paragraph
........
  r64767 | gregory.p.smith | 2008-07-07 06:31:58 +0200 (Mon, 07 Jul 2008) | 4 lines

  - Issue #3309: Fix bz2.BZFile itererator to release its internal lock
    properly when raising an exception due to the bz2file being closed.
    Prevents a deadlock.
........
  r64768 | josiah.carlson | 2008-07-07 06:51:46 +0200 (Mon, 07 Jul 2008) | 2 lines

  Fixed bugs 760475, 953599, and 1519.
........
  r64769 | gregory.p.smith | 2008-07-07 06:54:31 +0200 (Mon, 07 Jul 2008) | 2 lines

  Add commented out #_sha256 and #_sha512 lines per issue 3183.
........
  r64771 | gregory.p.smith | 2008-07-07 07:09:12 +0200 (Mon, 07 Jul 2008) | 4 lines

  - Issue #3094: httplib.HTTPSConnection Host: headers no longer include the
    redundant ":443" port number designation when the connection is using the
    default https port (443).
........
  r64772 | skip.montanaro | 2008-07-07 13:16:14 +0200 (Mon, 07 Jul 2008) | 2 lines

  Correct grammar.
........
  r64774 | andrew.kuchling | 2008-07-07 18:51:09 +0200 (Mon, 07 Jul 2008) | 1 line

  Fix example to match text
........
  r64775 | facundo.batista | 2008-07-07 19:02:59 +0200 (Mon, 07 Jul 2008) | 3 lines


  Issue 3306. Better control for a lenght in findmax() function.
........
  r64788 | georg.brandl | 2008-07-08 09:05:23 +0200 (Tue, 08 Jul 2008) | 2 lines

  Add missing ABCs to list.
........
  r64793 | nick.coghlan | 2008-07-08 16:21:42 +0200 (Tue, 08 Jul 2008) | 1 line

  Add missing NEWS and ACK entries for r64791
........
  r64835 | raymond.hettinger | 2008-07-10 11:31:08 +0200 (Thu, 10 Jul 2008) | 1 line

  Issue 3287: Raise correct exception for float inputs.
........
  r64836 | raymond.hettinger | 2008-07-10 12:28:41 +0200 (Thu, 10 Jul 2008) | 1 line

  Use operator.index() instead of n.__index__().
........
2008-07-16 03:43:04 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00