Commit graph

20792 commits

Author SHA1 Message Date
Victor Stinner
c60542b12b pytime: add _PyTime_check_mul_overflow() macro to avoid undefined behaviour
Overflow test in test_FromSecondsObject() fails on FreeBSD 10.0 buildbot which
uses clang. clang implements more aggressive optimization which gives
different result than GCC on undefined behaviours.

Check if a multiplication will overflow, instead of checking if a
multiplicatin had overflowed, to avoid undefined behaviour.

Add also debug information if the test on overflow fails.
2015-09-10 15:55:07 +02:00
Victor Stinner
350b51839a Fix test_time on platform with 32-bit time_t type
Filter also values for check_float_rounding().
2015-09-10 11:45:06 +02:00
Victor Stinner
4237d3474c Fix test_time on platform with 32-bit time_t type
Filter values which would overflow when converted to a C time_t type.
2015-09-10 10:10:39 +02:00
Victor Stinner
9c72f9b30a Fix test_time on Windows
* Filter values which would overflow on conversion to the C long type
  (for timeval.tv_sec).
* Adjust also the message of OverflowError on PyTime conversions
* test_time: add debug information if a timestamp conversion fails
2015-09-10 09:10:14 +02:00
Victor Stinner
3e2c8d84c6 test_time: rewrite PyTime API rounding tests
Drop all hardcoded tests. Instead, reimplement each function in Python, usually
using decimal.Decimal for the rounding mode.

Add much more values to the dataset. Test various timestamp units from
picroseconds to seconds, in integer and float.

Enhance also _PyTime_AsSecondsDouble().
2015-09-09 22:32:48 +02:00
Martin Panter
3f560c16e5 Merge 3.5 into 3.6 2015-09-09 06:28:08 +00:00
Martin Panter
6088b7bd49 Merge 3.4 into 3.5 2015-09-09 06:27:43 +00:00
Martin Panter
9499413508 os.sendfile(headers=None, trailers=None) arguments are not actually accepted
Needs to be tested on a BSD.
2015-09-09 05:29:24 +00:00
Martin Panter
a122b5a1fd Issue #23738: Merge 3.5 into 3.6 2015-09-09 03:01:17 +00:00
Martin Panter
0ff89099c7 Issue #23738: Merge 3.4 into 3.5 2015-09-09 01:56:53 +00:00
Martin Panter
bf19d16950 Issue #23738: Document and test actual keyword parameter names
Also fix signature because os.utime(..., ns=None) is not allowed.
2015-09-09 01:01:13 +00:00
Victor Stinner
cd5d765b0e cleanup datetime code
remove scories of round half up code and debug code.
2015-09-09 01:09:21 +02:00
Victor Stinner
7667f58151 Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going to nearest
even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards
-Infinity (ROUND_FLOOR).

pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix
also _PyTime_Divide() for negative numbers.

_PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing
rounding modes.
2015-09-09 01:02:23 +02:00
Victor Stinner
69cc487df4 Revert change 0eb8c182131e:
"""Issue #23517: datetime.timedelta constructor now rounds microseconds to
nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python
older than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN)."""

datetime.timedelta uses rounding mode ROUND_HALF_EVEN again.
2015-09-08 23:58:54 +02:00
Serhiy Storchaka
8a6023d05f Fixed tests for shutil.make_archive() with relative base_name in the case when
the path of the directory for temporary files contains symlinks.
2015-09-08 10:00:43 +03:00
Serhiy Storchaka
050a143a3f Fixed tests for shutil.make_archive() with relative base_name in the case when
the path of the directory for temporary files contains symlinks.
2015-09-08 10:00:22 +03:00
Serhiy Storchaka
5558d4f2f8 Fixed tests for shutil.make_archive() with relative base_name in the case when
the path of the directory for temporary files contains symlinks.
2015-09-08 09:59:02 +03:00
Serhiy Storchaka
899f32fe1e Issue #24982: shutil.make_archive() with the "zip" format now adds entries
for directories (including empty directories) in ZIP file.
Added test for comparing shutil.make_archive() with the "zip" command.
2015-09-08 05:53:42 +03:00
Serhiy Storchaka
d941d7a586 Issue #24982: shutil.make_archive() with the "zip" format now adds entries
for directories (including empty directories) in ZIP file.
Added test for comparing shutil.make_archive() with the "zip" command.
2015-09-08 05:51:00 +03:00
Serhiy Storchaka
2504cecebd Issue #24982: shutil.make_archive() with the "zip" format now adds entries
for directories (including empty directories) in ZIP file.
Added test for comparing shutil.make_archive() with the "zip" command.
2015-09-08 05:47:23 +03:00
Serhiy Storchaka
6574a38327 Raise more correct exception on overflow in setting buffer_size attribute of
expat parser.
2015-09-07 22:54:33 +03:00
Serhiy Storchaka
6c8b66cd26 Raise more correct exception on overflow in setting buffer_size attribute of
expat parser.
2015-09-07 22:54:08 +03:00
Serhiy Storchaka
de5f9f4f70 Raise more correct exception on overflow in setting buffer_size attribute of
expat parser.
2015-09-07 22:51:56 +03:00
Serhiy Storchaka
9df7035f5b Issue #25019: Fixed a crash caused by setting non-string key of expat parser.
Added additional tests for expat parser attributes.
Based on patch by John Leitch.
2015-09-07 22:41:04 +03:00
Serhiy Storchaka
3b1bc7828d Issue #25019: Fixed a crash caused by setting non-string key of expat parser.
Added additional tests for expat parser attributes.
Based on patch by John Leitch.
2015-09-07 22:38:34 +03:00
Serhiy Storchaka
931331a328 Issue #25019: Fixed a crash caused by setting non-string key of expat parser.
Added additional tests for expat parser attributes.
Based on patch by John Leitch.
2015-09-07 22:37:02 +03:00
Serhiy Storchaka
adbb4d8de7 Issue #25018: Fixed testing shutil.make_archive() with relative base_name on
Windows.  The test now makes sense on non-Windows.  Added similar test for
zip format.
2015-09-07 19:59:38 +03:00
Serhiy Storchaka
ae0d7527f3 Issue #25018: Fixed testing shutil.make_archive() with relative base_name on
Windows.  The test now makes sense on non-Windows.  Added similar test for
zip format.
2015-09-07 19:59:24 +03:00
Serhiy Storchaka
eba8feedfa Issue #25018: Fixed testing shutil.make_archive() with relative base_name on
Windows.  The test now makes sense on non-Windows.  Added similar test for
zip format.
2015-09-07 19:58:23 +03:00
Serhiy Storchaka
8bfb47a441 Explicitly test archive name in shutil.make_archive() tests to expose failure
details in issue25018.
2015-09-07 13:57:21 +03:00
Serhiy Storchaka
8c85a2083f Explicitly test archive name in shutil.make_archive() tests to expose failure
details in issue25018.
2015-09-07 13:56:49 +03:00
Serhiy Storchaka
a091a8221e Explicitly test archive name in shutil.make_archive() tests to expose failure
details in issue25018.
2015-09-07 13:55:25 +03:00
Steve Dower
45fd95155f Merge from 3.5 2015-09-06 22:31:26 -07:00
Steve Dower
96d4943846 Reapplied change to test_warnings.py to test_warnings/__init__.py. 2015-09-06 22:30:40 -07:00
Steve Dower
f35bd306ff Merge from 3.5.0 branch. 2015-09-06 22:27:42 -07:00
Martin Panter
1b8be1fbe5 Issue #25004: Merge 3.5 into 3.6 2015-09-07 04:07:06 +00:00
Martin Panter
da19767b86 Issue #25004: Merge 3.4 into 3.5 2015-09-07 04:04:40 +00:00
Martin Panter
e8d58d1f02 Issue #25004: Handle out-of-disk-space error in LargeMmapTests
Patch from John Beck.
2015-09-07 02:57:47 +00:00
Steve Dower
e5b5895b5b Issue #24917: time_strftime() buffer over-read. 2015-09-06 19:20:51 -07:00
Ezio Melotti
564cf7b62c #23144: merge with 3.5. 2015-09-06 21:49:48 +03:00
Ezio Melotti
20a2c6482e #23144: merge with 3.4. 2015-09-06 21:44:45 +03:00
Ezio Melotti
6f2bb98966 #23144: Make sure that HTMLParser.feed() returns all the data, even when convert_charrefs is True. 2015-09-06 21:38:06 +03:00
Alexander Belopolsky
7827a5b7c2 Closes Issue#22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'. 2015-09-06 13:07:21 -04:00
Serhiy Storchaka
40dc328cc2 Fix, refactor and extend tests for shutil.make_archive(). 2015-09-06 18:34:22 +03:00
Serhiy Storchaka
2ba39800e5 Fix, refactor and extend tests for shutil.make_archive(). 2015-09-06 18:33:52 +03:00
Serhiy Storchaka
527ef0792f Fix, refactor and extend tests for shutil.make_archive(). 2015-09-06 18:33:19 +03:00
Serhiy Storchaka
8fecd42d26 Use support.change_cwd() in tests. 2015-09-06 14:15:40 +03:00
Serhiy Storchaka
5fbadb63ef Use support.change_cwd() in tests. 2015-09-06 14:14:49 +03:00
Serhiy Storchaka
2a23adf440 Use support.change_cwd() in tests. 2015-09-06 14:13:25 +03:00
Larry Hastings
714e49371b Issue #24305: Prevent import subsystem stack frames from being counted
by the warnings.warn(stacklevel=) parameter.
2015-09-06 00:39:37 -07:00