Skip to content

Sync with CPython 3.9 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build

on:
pull_request:
branches:
- "3.7"
- "3.8"
- "3.9"

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: sudo apt-get install gettext

- name: Build
run: VERSION=${{ github.event.pull_request.base.ref }} make
26 changes: 26 additions & 0 deletions .github/workflows/deploy-gh-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: deploy-gh-page

on:
push:
branches:
- "3.9"

jobs:
cd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: sudo apt-get install gettext

- name: Build
run: make

- name: Deploy to gh page
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: ../cpython/Doc/build/html
CLEAN: true
52 changes: 52 additions & 0 deletions .github/workflows/py39-sync-cpython.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: python-3.9-sync-with-cpython

on:
push:
branches:
- "3.9"
schedule:
- cron: "0 0 * * *"

jobs:
sync:
runs-on: ubuntu-latest
env:
VERSION: "3.9"
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.VERSION }}

- name: Set env
run: echo "LATEST_COMMIT_ID=$(git ls-remote https://github.com/python/CPython.git $VERSION | head -c 8)" >> $GITHUB_ENV

- name: Install Dependencies
run: sudo apt-get install gettext

- name: Sync with CPython
run: make clone && make merge && make rm_cpython

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
commit-message: sync with cpython ${{ env.LATEST_COMMIT_ID }}
committer: GitHub <noreply@github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
base: ${{ env.VERSION }}
branch: cron/sync/${{ env.VERSION }}
delete-branch: true
title: 'Sync with CPython ${{ env.VERSION }}'
body: |
Sync with CPython ${{ env.VERSION }}
labels: |
sync-cpython
automation
team-reviewers: |
owners
maintainers

- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
VENV := ~/.venvs/python-docs-i18n/
PYTHON := $(shell which python3)
MODE := autobuild-dev-html
BRANCH = $(shell git describe --contains --all HEAD)
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD))
JOBS = 1


.PHONY: all
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb $(SPHINX_CONF)
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone
mkdir -p $(LC_MESSAGES)
for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)


$(SPHINX_CONF):
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE)
clone:
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists"
cd $(CPYTHON_CLONE) && git checkout $(BRANCH)


Expand Down Expand Up @@ -104,3 +104,7 @@ update_txconfig:
.PHONY: fuzzy
fuzzy:
for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr

.PHONY: rm_cpython
rm_cpython:
rm -rf $(CPYTHON_CLONE)
6 changes: 3 additions & 3 deletions bugs.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-06-20 18:08+0800\n"
"POT-Creation-Date: 2021-09-07 00:30+0000\n"
"PO-Revision-Date: 2018-10-13 16:29+0800\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand Down Expand Up @@ -173,8 +173,8 @@ msgstr ""

#: ../../bugs.rst:84
msgid ""
"`Bug Report Writing Guidelines <https://developer.mozilla.org/en-US/docs/"
"Mozilla/QA/Bug_writing_guidelines>`_"
"`Bug Writing Guidelines <https://bugzilla.mozilla.org/page.cgi?id=bug-"
"writing.html>`_"
msgstr ""

#: ../../bugs.rst:84
Expand Down
44 changes: 21 additions & 23 deletions c-api/arg.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-06-20 18:08+0800\n"
"POT-Creation-Date: 2021-09-07 00:30+0000\n"
"PO-Revision-Date: 2018-05-23 14:29+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand Down Expand Up @@ -240,7 +240,7 @@ msgstr ""
msgid ""
"Requires that the Python object is a :class:`bytes` object, without "
"attempting any conversion. Raises :exc:`TypeError` if the object is not a "
"bytes object. The C variable may also be declared as :c:type:`PyObject\\*`."
"bytes object. The C variable may also be declared as :c:type:`PyObject*`."
msgstr ""

#: ../../c-api/arg.rst:139
Expand All @@ -252,7 +252,7 @@ msgid ""
"Requires that the Python object is a :class:`bytearray` object, without "
"attempting any conversion. Raises :exc:`TypeError` if the object is not a :"
"class:`bytearray` object. The C variable may also be declared as :c:type:"
"`PyObject\\*`."
"`PyObject*`."
msgstr ""

#: ../../c-api/arg.rst:156
Expand Down Expand Up @@ -319,7 +319,7 @@ msgstr ""
msgid ""
"Requires that the Python object is a Unicode object, without attempting any "
"conversion. Raises :exc:`TypeError` if the object is not a Unicode object. "
"The C variable may also be declared as :c:type:`PyObject\\*`."
"The C variable may also be declared as :c:type:`PyObject*`."
msgstr ""

#: ../../c-api/arg.rst:192
Expand Down Expand Up @@ -347,13 +347,12 @@ msgstr ""
#: ../../c-api/arg.rst:198
msgid ""
"This format requires two arguments. The first is only used as input, and "
"must be a :c:type:`const char\\*` which points to the name of an encoding as "
"a NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is "
"must be a :c:type:`const char*` which points to the name of an encoding as a "
"NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is "
"used. An exception is raised if the named encoding is not known to Python. "
"The second argument must be a :c:type:`char\\*\\*`; the value of the pointer "
"it references will be set to a buffer with the contents of the argument "
"text. The text will be encoded in the encoding specified by the first "
"argument."
"The second argument must be a :c:type:`char**`; the value of the pointer it "
"references will be set to a buffer with the contents of the argument text. "
"The text will be encoded in the encoding specified by the first argument."
msgstr ""

#: ../../c-api/arg.rst:206
Expand Down Expand Up @@ -393,10 +392,10 @@ msgstr ""
#: ../../c-api/arg.rst:221
msgid ""
"It requires three arguments. The first is only used as input, and must be "
"a :c:type:`const char\\*` which points to the name of an encoding as a NUL-"
"a :c:type:`const char*` which points to the name of an encoding as a NUL-"
"terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. "
"An exception is raised if the named encoding is not known to Python. The "
"second argument must be a :c:type:`char\\*\\*`; the value of the pointer it "
"second argument must be a :c:type:`char**`; the value of the pointer it "
"references will be set to a buffer with the contents of the argument text. "
"The text will be encoded in the encoding specified by the first argument. "
"The third argument must be a pointer to an integer; the referenced integer "
Expand Down Expand Up @@ -619,7 +618,7 @@ msgstr ""
msgid ""
"Store a Python object in a C object pointer. This is similar to ``O``, but "
"takes two C arguments: the first is the address of a Python type object, the "
"second is the address of the C variable (of type :c:type:`PyObject\\*`) into "
"second is the address of the C variable (of type :c:type:`PyObject*`) into "
"which the object pointer is stored. If the Python object does not have the "
"required type, :exc:`TypeError` is raised."
msgstr ""
Expand All @@ -632,14 +631,14 @@ msgstr ""
msgid ""
"Convert a Python object to a C variable through a *converter* function. "
"This takes two arguments: the first is a function, the second is the address "
"of a C variable (of arbitrary type), converted to :c:type:`void \\*`. The "
"of a C variable (of arbitrary type), converted to :c:type:`void *`. The "
"*converter* function in turn is called as follows::"
msgstr ""

#: ../../c-api/arg.rst:339
msgid ""
"where *object* is the Python object to be converted and *address* is the :c:"
"type:`void\\*` argument that was passed to the :c:func:`PyArg_Parse\\*` "
"type:`void*` argument that was passed to the :c:func:`PyArg_Parse\\*` "
"function. The returned *status* should be ``1`` for a successful conversion "
"and ``0`` if the conversion has failed. When the conversion fails, the "
"*converter* function should raise an exception and leave the content of "
Expand Down Expand Up @@ -837,13 +836,12 @@ msgid ""
"should be passed as *args*; it must actually be a tuple. The length of the "
"tuple must be at least *min* and no more than *max*; *min* and *max* may be "
"equal. Additional arguments must be passed to the function, each of which "
"should be a pointer to a :c:type:`PyObject\\*` variable; these will be "
"filled in with the values from *args*; they will contain borrowed "
"references. The variables which correspond to optional parameters not given "
"by *args* will not be filled in; these should be initialized by the caller. "
"This function returns true on success and false if *args* is not a tuple or "
"contains the wrong number of elements; an exception will be set if there was "
"a failure."
"should be a pointer to a :c:type:`PyObject*` variable; these will be filled "
"in with the values from *args*; they will contain borrowed references. The "
"variables which correspond to optional parameters not given by *args* will "
"not be filled in; these should be initialized by the caller. This function "
"returns true on success and false if *args* is not a tuple or contains the "
"wrong number of elements; an exception will be set if there was a failure."
msgstr ""

#: ../../c-api/arg.rst:493
Expand Down Expand Up @@ -1107,7 +1105,7 @@ msgstr ""
msgid ""
"Convert *anything* to a Python object through a *converter* function. The "
"function is called with *anything* (which should be compatible with :c:type:"
"`void \\*`) as its argument and should return a \"new\" Python object, or "
"`void*`) as its argument and should return a \"new\" Python object, or "
"``NULL`` if an error occurred."
msgstr ""

Expand Down
16 changes: 9 additions & 7 deletions c-api/bool.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-26 18:54+0800\n"
"POT-Creation-Date: 2021-09-07 00:30+0000\n"
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
"Last-Translator: Ching-Lung Chuang\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand All @@ -32,34 +32,36 @@ msgid ""
msgstr ""

#: ../../c-api/bool.rst:16
msgid "Return true if *o* is of type :c:data:`PyBool_Type`."
msgid ""
"Return true if *o* is of type :c:data:`PyBool_Type`. This function always "
"succeeds."
msgstr ""

#: ../../c-api/bool.rst:21
#: ../../c-api/bool.rst:22
msgid ""
"The Python ``False`` object. This object has no methods. It needs to be "
"treated just like any other object with respect to reference counts."
msgstr ""

#: ../../c-api/bool.rst:27
#: ../../c-api/bool.rst:28
msgid ""
"The Python ``True`` object. This object has no methods. It needs to be "
"treated just like any other object with respect to reference counts."
msgstr ""

#: ../../c-api/bool.rst:33
#: ../../c-api/bool.rst:34
msgid ""
"Return :const:`Py_False` from a function, properly incrementing its "
"reference count."
msgstr ""

#: ../../c-api/bool.rst:39
#: ../../c-api/bool.rst:40
msgid ""
"Return :const:`Py_True` from a function, properly incrementing its reference "
"count."
msgstr ""

#: ../../c-api/bool.rst:45
#: ../../c-api/bool.rst:46
msgid ""
"Return a new reference to :const:`Py_True` or :const:`Py_False` depending on "
"the truth value of *v*."
Expand Down
26 changes: 14 additions & 12 deletions c-api/buffer.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-06-20 18:08+0800\n"
"POT-Creation-Date: 2021-09-07 00:30+0000\n"
"PO-Revision-Date: 2018-05-23 14:30+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand Down Expand Up @@ -453,6 +453,10 @@ msgstr ""
msgid "C or F"
msgstr ""

#: ../../c-api/buffer.rst:304
msgid ":c:macro:`PyBUF_ND`"
msgstr ""

#: ../../c-api/buffer.rst:309
msgid "compound requests"
msgstr ""
Expand Down Expand Up @@ -568,17 +572,15 @@ msgstr ""
msgid ""
"Send a request to *exporter* to fill in *view* as specified by *flags*. If "
"the exporter cannot provide a buffer of the exact type, it MUST raise :c:"
"data:`PyExc_BufferError`, set :c:member:`view->obj` to ``NULL`` and return "
"``-1``."
"data:`PyExc_BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``."
msgstr ""

#: ../../c-api/buffer.rst:444
msgid ""
"On success, fill in *view*, set :c:member:`view->obj` to a new reference to "
"On success, fill in *view*, set ``view->obj`` to a new reference to "
"*exporter* and return 0. In the case of chained buffer providers that "
"redirect requests to a single object, :c:member:`view->obj` MAY refer to "
"this object instead of *exporter* (See :ref:`Buffer Object Structures "
"<buffer-structs>`)."
"redirect requests to a single object, ``view->obj`` MAY refer to this object "
"instead of *exporter* (See :ref:`Buffer Object Structures <buffer-structs>`)."
msgstr ""

#: ../../c-api/buffer.rst:449
Expand All @@ -591,8 +593,8 @@ msgstr ""

#: ../../c-api/buffer.rst:457
msgid ""
"Release the buffer *view* and decrement the reference count for :c:member:"
"`view->obj`. This function MUST be called when the buffer is no longer being "
"Release the buffer *view* and decrement the reference count for ``view-"
">obj``. This function MUST be called when the buffer is no longer being "
"used, otherwise reference leaks may occur."
msgstr ""

Expand Down Expand Up @@ -663,9 +665,9 @@ msgstr ""

#: ../../c-api/buffer.rst:519
msgid ""
"On success, set :c:member:`view->obj` to a new reference to *exporter* and "
"return 0. Otherwise, raise :c:data:`PyExc_BufferError`, set :c:member:`view-"
">obj` to ``NULL`` and return ``-1``;"
"On success, set ``view->obj`` to a new reference to *exporter* and return 0. "
"Otherwise, raise :c:data:`PyExc_BufferError`, set ``view->obj`` to ``NULL`` "
"and return ``-1``;"
msgstr ""

#: ../../c-api/buffer.rst:523
Expand Down
Loading