https://github.com/python/cpython/commit/3b60cd8ec96581a9bdff7f7440033a22426dbf1e
commit: 3b60cd8ec96581a9bdff7f7440033a22426dbf1e
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: serhiy-storchaka <storch...@gmail.com>
date: 2025-04-07T14:52:02Z
summary:

[3.13] gh-131852: Filter out POT-Creation-Date in msgfmt (GH-131880) (GH-132217)

(cherry picked from commit ad6a032cebf59d1668caa7e726aa5da72e1cbb5c)

Co-authored-by: Stan Ulbrych <89152624+stanfromirel...@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.ro...@gmail.com>

files:
A Misc/NEWS.d/next/Tools-Demos/2025-03-29-16-20-00.gh-issue-131852.afuefb.rst
M Lib/test/test_tools/msgfmt_data/general.json
M Lib/test/test_tools/msgfmt_data/general.mo
M Tools/i18n/msgfmt.py

diff --git a/Lib/test/test_tools/msgfmt_data/general.json 
b/Lib/test/test_tools/msgfmt_data/general.json
index 8ceb34cd17fb07..0586113985a112 100644
--- a/Lib/test/test_tools/msgfmt_data/general.json
+++ b/Lib/test/test_tools/msgfmt_data/general.json
@@ -1,7 +1,7 @@
 [
     [
         "",
-        "Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2024-10-26 
18:06+0200\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME 
<EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <l...@li.org>\nMIME-Version: 
1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"
+        "Project-Id-Version: PACKAGE VERSION\nPO-Revision-Date: YEAR-MO-DA 
HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE 
<l...@li.org>\nMIME-Version: 1.0\nContent-Type: text/plain; 
charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"
     ],
     [
         "\n newlines \n",
diff --git a/Lib/test/test_tools/msgfmt_data/general.mo 
b/Lib/test/test_tools/msgfmt_data/general.mo
index 44b7363071a98b..ee905cbb3ec58d 100644
Binary files a/Lib/test/test_tools/msgfmt_data/general.mo and 
b/Lib/test/test_tools/msgfmt_data/general.mo differ
diff --git 
a/Misc/NEWS.d/next/Tools-Demos/2025-03-29-16-20-00.gh-issue-131852.afuefb.rst 
b/Misc/NEWS.d/next/Tools-Demos/2025-03-29-16-20-00.gh-issue-131852.afuefb.rst
new file mode 100644
index 00000000000000..470c1b0879f19f
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Tools-Demos/2025-03-29-16-20-00.gh-issue-131852.afuefb.rst
@@ -0,0 +1,2 @@
+:program:`msgfmt` no longer adds the ``POT-Creation-Date`` to generated 
``.mo`` files
+for consistency with GNU ``msgfmt``.
diff --git a/Tools/i18n/msgfmt.py b/Tools/i18n/msgfmt.py
index c0da976979848a..ecebf5d6a51ee8 100755
--- a/Tools/i18n/msgfmt.py
+++ b/Tools/i18n/msgfmt.py
@@ -148,14 +148,19 @@ def make(filename, outfile):
             msgctxt = b''
         elif l.startswith('msgid') and not l.startswith('msgid_plural'):
             if section == STR:
-                add(msgctxt, msgid, msgstr, fuzzy)
-                msgctxt = None
                 if not msgid:
+                    # Filter out POT-Creation-Date
+                    # See issue #131852
+                    msgstr = b''.join(line for line in msgstr.splitlines(True)
+                                      if not 
line.startswith(b'POT-Creation-Date:'))
+
                     # See whether there is an encoding declaration
                     p = HeaderParser()
                     charset = 
p.parsestr(msgstr.decode(encoding)).get_content_charset()
                     if charset:
                         encoding = charset
+                add(msgctxt, msgid, msgstr, fuzzy)
+                msgctxt = None
             section = ID
             l = l[5:]
             msgid = msgstr = b''

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to