Skip to content

Commit 3ba72d7

Browse files
author
Anselm Kruis
committed
Merge branch master into master-slp.
2 parents d533ad9 + 3110a37 commit 3ba72d7

File tree

15 files changed

+327
-111
lines changed

15 files changed

+327
-111
lines changed

.codecov.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: true
4+
comment:
5+
behavior: new
6+
layout: header, diff
7+
require_changes: false
8+
coverage:
9+
precision: 2
10+
range:
11+
- 70.0
12+
- 100.0
13+
round: down
14+
status:
15+
changes: false
16+
patch: true
17+
project: true
18+
parsers:
19+
gcov:
20+
branch_detection:
21+
conditional: true
22+
loop: true
23+
macro: false
24+
method: false
25+
javascript:
26+
enable_partials: false

.github/CONTRIBUTING.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Contributing to Python
2+
======================
3+
4+
Build Status
5+
------------
6+
7+
- master
8+
9+
+ .. image:: https://travis-ci.org/python/cpython.svg?branch=master
10+
:target: https://travis-ci.org/python/cpython
11+
12+
+ .. image:: https://codecov.io/gh/python/cpython/branch/master/graph/badge.svg
13+
:target: https://codecov.io/gh/python/cpython
14+
15+
+ `Stable buildbots <http://buildbot.python.org/3.x.stable/>`_
16+
17+
- 3.6
18+
19+
+ `Stable buildbots <http://buildbot.python.org/3.6.stable/>`_
20+
21+
- 3.5
22+
23+
+ `Stable buildbots <http://buildbot.python.org/3.5.stable/>`_
24+
25+
- 2.7
26+
27+
+ `Stable buildbots <http://buildbot.python.org/2.7.stable/>`_
28+
29+
30+
Contribution Guidelines
31+
-----------------------
32+
Please read the `devguide <https://cpython-devguide.readthedocs.io/>`_ for
33+
guidance on how to contribute to this project. The documentation covers
34+
everything from how to build the code to submitting a pull request. There are
35+
also suggestions on how you can most effectively help the project.
36+
37+
Please be aware that our workflow does deviate slightly from the typical GitHub
38+
project. Issues are tracked at https://bugs.python.org/ and should be mentioned
39+
in pull requests using the format of ``bpo-12345`` . If your pull request is in
40+
response to a specific issue then please mention it in the title,
41+
e.g. “bpo-12345: fix comment in tokenizer.c”.
42+
43+
If you are making a code contribution or large documentation contribution,
44+
please feel free to add yourself to the ``Misc/ACKS`` file alphabetically.
45+
46+
47+
Code of Conduct
48+
---------------
49+
All interactions for this project are covered by the
50+
`PSF Code of Conduct <https://www.python.org/psf/codeofconduct/>`_. Everyone is
51+
expected to be open, considerate, and respectful of others no matter their
52+
position within the project.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

.travis.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
language: c
2+
dist: trusty
3+
sudo: false
4+
group: beta
5+
6+
# To cache doc-building dependencies.
7+
cache: pip
8+
9+
os:
10+
- linux
11+
# macOS builds are disabled as the machines are under-provisioned on Travis,
12+
# adding up to an extra hour completing a full CI run.
13+
#- osx
14+
15+
compiler:
16+
- clang
17+
- gcc
18+
19+
env:
20+
- TESTING=cpython
21+
22+
matrix:
23+
allow_failures:
24+
- env:
25+
- TESTING=coverage
26+
include:
27+
- os: linux
28+
language: python
29+
python: 3.5
30+
env:
31+
- TESTING=docs
32+
before_script:
33+
- cd Doc
34+
- make venv PYTHON=python3
35+
script:
36+
- make html SPHINXBUILD="./venv/bin/python3 -m sphinx" SPHINXOPTS="-q"
37+
- os: linux
38+
language: c
39+
compiler: clang
40+
env:
41+
- TESTING=coverage
42+
before_script:
43+
- ./configure
44+
- make -s -j4
45+
# Need a venv that can parse covered code.
46+
- ./python -m venv venv
47+
- ./venv/bin/python -m pip install -U coverage
48+
script:
49+
# Skip tests that re-run the entire test suite.
50+
- ./venv/bin/python -m coverage run --pylib -m test -uall -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn
51+
after_script: # Probably should be after_success once test suite updated to run under coverage.py.
52+
# Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files.
53+
- source ./venv/bin/activate
54+
- bash <(curl -s https://codecov.io/bash)
55+
- os: linux
56+
language: cpp
57+
compiler: clang
58+
env:
59+
- TESTING="C++ header compatibility"
60+
before_script:
61+
- ./configure
62+
script:
63+
- echo '#include "Python.h"' > test.cc && $CXX -c test.cc -o /dev/null -I ./Include -I .
64+
65+
# Travis provides only 2 cores, so don't overdue the parallelism and waste memory.
66+
before_script:
67+
- ./configure --with-pydebug
68+
- make -j4
69+
70+
script:
71+
# `-r -w` implicitly provided through `make buildbottest`.
72+
- make buildbottest TESTOPTS="-j4"
73+
74+
notifications:
75+
email: false
76+
irc:
77+
channels:
78+
# This is set to a secure variable to prevent forks from notifying the
79+
# IRC channel whenever they fail a build. This can be removed when travis
80+
# implements https://github.com/travis-ci/travis-ci/issues/1094.
81+
# The actual value here is: irc.freenode.net#python-dev
82+
- secure: "s7kAkpcom2yUJ8XqyjFI0obJmhAGrn1xmoivdaPdgBIA++X47TBp1x4pgDsbEsoalef7bEwa4l07KdT4qa+DOd/c4QxaWom7fbN3BuLVsZuVfODnl79+gYq/TAbGfyH+yDs18DXrUfPgwD7C5aW32ugsqAOd4iWzfGJQ5OrOZzqzGjYdYQUEkJFXgxDEIb4aHvxNDWGO3Po9uKISrhb5saQ0l776yLo1Ur7M4oxl8RTbCdgX0vf5TzPg52BgvZpOgt3DHOUYPeiJLKNjAE6ibg0U95sEvMfHX77nz4aFY4/3UI6FFaRla34rZ+mYKrn0TdxOhera1QOgPmM6HzdO4K44FpfK1DS0Xxk9U9/uApq+cG0bU3W+cVUHDBe5+90lpRBAXHeHCgT7TI8gec614aiT8lEr3+yH8OBRYGzkjNK8E2LJZ/SxnVxDe7aLF6AWcoWLfS6/ziAIBFQ5Nc4U72CT8fGVSkl8ywPiRlvixKdvTODMSZo0jMqlfZSNaAPTsNRx4wu5Uis4qekwe32Fz4aB6KGpsuuVjBi+H6v0RKxNJNGY3JKDiEH2TK0UE2auJ5GvLW48aUVFcQMB7euCWYXlSWVRHh3WLU8QXF29Dw4JduRZqUpOdRgMHU79UHRq+mkE0jAS/nBcS6CvsmxCpTSrfVYuMOu32yt18QQoTyU="
83+
on_success: change
84+
on_failure: always
85+
skip_join: true

Doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PAPER =
1010
SOURCES =
1111
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
1212

13-
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
13+
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_elements.papersize=$(PAPER) \
1414
$(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
1515

1616
.PHONY: help build html htmlhelp latex text changes linkcheck \

Doc/conf.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,24 @@
104104
# Options for LaTeX output
105105
# ------------------------
106106

107+
# Get LaTeX to handle Unicode correctly
108+
latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
109+
110+
# Additional stuff for the LaTeX preamble.
111+
latex_elements['preamble'] = r'''
112+
\authoraddress{
113+
\strong{Python Software Foundation}\\
114+
Email: \email{[email protected]}
115+
}
116+
\let\Verbatim=\OriginalVerbatim
117+
\let\endVerbatim=\endOriginalVerbatim
118+
'''
119+
107120
# The paper size ('letter' or 'a4').
108-
latex_paper_size = 'a4'
121+
latex_elements['papersize'] = 'a4'
109122

110123
# The font size ('10pt', '11pt' or '12pt').
111-
latex_font_size = '10pt'
124+
latex_elements['font_size'] = '10pt'
112125

113126
# Grouping the document tree into LaTeX files. List of tuples
114127
# (source start file, target name, title, author, document class [howto/manual]).
@@ -141,22 +154,9 @@
141154
for fn in os.listdir('howto')
142155
if fn.endswith('.rst') and fn != 'index.rst')
143156

144-
# Additional stuff for the LaTeX preamble.
145-
latex_preamble = r'''
146-
\authoraddress{
147-
\strong{Python Software Foundation}\\
148-
Email: \email{[email protected]}
149-
}
150-
\let\Verbatim=\OriginalVerbatim
151-
\let\endVerbatim=\endOriginalVerbatim
152-
'''
153-
154157
# Documents to append as an appendix to all manuals.
155158
latex_appendices = ['glossary', 'about', 'license', 'copyright']
156159

157-
# Get LaTeX to handle Unicode correctly
158-
latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
159-
160160
# Options for Epub output
161161
# -----------------------
162162

Doc/library/weakref.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ Extension types can easily be made to support weak references; see
166166
performed by the program during iteration may cause items in the
167167
dictionary to vanish "by magic" (as a side effect of garbage collection).
168168

169-
:class:`WeakKeyDictionary` objects have the following additional methods. These
170-
expose the internal references directly. The references are not guaranteed to
169+
:class:`WeakKeyDictionary` objects have an additional method that
170+
exposes the internal references directly. The references are not guaranteed to
171171
be "live" at the time they are used, so the result of calling the references
172172
needs to be checked before being used. This can be used to avoid creating
173173
references that will cause the garbage collector to keep the keys around longer
@@ -192,9 +192,9 @@ than needed.
192192
by the program during iteration may cause items in the dictionary to vanish "by
193193
magic" (as a side effect of garbage collection).
194194

195-
:class:`WeakValueDictionary` objects have the following additional methods.
196-
These method have the same issues as the and :meth:`keyrefs` method of
197-
:class:`WeakKeyDictionary` objects.
195+
:class:`WeakValueDictionary` objects have an additional method that has the
196+
same issues as the :meth:`keyrefs` method of :class:`WeakKeyDictionary`
197+
objects.
198198

199199

200200
.. method:: WeakValueDictionary.valuerefs()

Doc/tools/extensions/pyspecific.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636
ISSUE_URI = 'https://bugs.python.org/issue%s'
37-
SOURCE_URI = 'https://hg.python.org/cpython/file/3.6/%s'
37+
SOURCE_URI = 'https://github.com/python/cpython/tree/master/%s'
3838

3939
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
4040
from docutils.parsers.rst.states import Body
@@ -79,7 +79,7 @@ def new_depart_literal_block(self, node):
7979

8080
def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
8181
issue = utils.unescape(text)
82-
text = 'issue ' + issue
82+
text = 'bpo-' + issue
8383
refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue)
8484
return [refnode], []
8585

@@ -225,7 +225,7 @@ def run(self):
225225

226226
# Support for including Misc/NEWS
227227

228-
issue_re = re.compile('([Ii])ssue #([0-9]+)')
228+
issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)')
229229
whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")
230230

231231

@@ -253,7 +253,7 @@ def run(self):
253253
text = 'The NEWS file is not available.'
254254
node = nodes.strong(text, text)
255255
return [node]
256-
content = issue_re.sub(r'`\1ssue #\2 <https://bugs.python.org/\2>`__',
256+
content = issue_re.sub(r'`bpo-\1 <https://bugs.python.org/issue\1>`__',
257257
content)
258258
content = whatsnew_re.sub(r'\1', content)
259259
# remove first 3 lines as they are the main heading

Lib/contextlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __exit__(self, type, value, traceback):
105105
# raised inside the "with" statement from being suppressed.
106106
return exc is not value
107107
except RuntimeError as exc:
108-
# Don't re-raise the passed in exception. (issue27112)
108+
# Don't re-raise the passed in exception. (issue27122)
109109
if exc is value:
110110
return False
111111
# Likewise, avoid suppressing if a StopIteration exception

Lib/test/datetimetester.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,47 @@ def test_microsecond_rounding(self):
19891989
self.assertEqual(t.second, 0)
19901990
self.assertEqual(t.microsecond, 7812)
19911991

1992+
def test_timestamp_limits(self):
1993+
# minimum timestamp
1994+
min_dt = self.theclass.min.replace(tzinfo=timezone.utc)
1995+
min_ts = min_dt.timestamp()
1996+
try:
1997+
# date 0001-01-01 00:00:00+00:00: timestamp=-62135596800
1998+
self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc),
1999+
min_dt)
2000+
except (OverflowError, OSError) as exc:
2001+
# the date 0001-01-01 doesn't fit into 32-bit time_t,
2002+
# or platform doesn't support such very old date
2003+
self.skipTest(str(exc))
2004+
2005+
# maximum timestamp: set seconds to zero to avoid rounding issues
2006+
max_dt = self.theclass.max.replace(tzinfo=timezone.utc,
2007+
second=0, microsecond=0)
2008+
max_ts = max_dt.timestamp()
2009+
# date 9999-12-31 23:59:00+00:00: timestamp 253402300740
2010+
self.assertEqual(self.theclass.fromtimestamp(max_ts, tz=timezone.utc),
2011+
max_dt)
2012+
2013+
# number of seconds greater than 1 year: make sure that the new date
2014+
# is not valid in datetime.datetime limits
2015+
delta = 3600 * 24 * 400
2016+
2017+
# too small
2018+
ts = min_ts - delta
2019+
# converting a Python int to C time_t can raise a OverflowError,
2020+
# especially on 32-bit platforms.
2021+
with self.assertRaises((ValueError, OverflowError)):
2022+
self.theclass.fromtimestamp(ts)
2023+
with self.assertRaises((ValueError, OverflowError)):
2024+
self.theclass.utcfromtimestamp(ts)
2025+
2026+
# too big
2027+
ts = max_dt.timestamp() + delta
2028+
with self.assertRaises((ValueError, OverflowError)):
2029+
self.theclass.fromtimestamp(ts)
2030+
with self.assertRaises((ValueError, OverflowError)):
2031+
self.theclass.utcfromtimestamp(ts)
2032+
19922033
def test_insane_fromtimestamp(self):
19932034
# It's possible that some platform maps time_t to double,
19942035
# and that this test will fail there. This test should

0 commit comments

Comments
 (0)