svn commit: r1930867 - subversion/trunk/tools/dist

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <176674782204.3830689.11018347829267095714@svn02-us-east.apache.org>
Author: kotkov
Date: Fri Dec 26 11:17:01 2025
New Revision: 1930867

Log:
Fix using an invalid "wx" file mode in tools/dist/release.py.

I faced this issue when calling the `create_release_branch` command.

Apparently, open() requires exactly one of create/read/write/append modes.
While "wx" may have been accepted previously and worked in a non-standard
way, it now raises a ValueError [1, 2]:

  > python
  Python 3.10.12 (main, Nov  4 2025, 08:48:33) [GCC 11.4.0] on linux

  > python -c "open('/tmp/foo', 'wx')"
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ValueError: must have exactly one of create/read/write/append mode

* tools/dist/release.py
  (create_status_file_on_branch): Pass 'x' as file open mode instead of 'wx'.
   Using the exclusive create mode seems to imply write.

[1]: https://docs.python.org/3/library/functions.html#open
[2]: https://bugs.python.org/issue12760

Modified:
   subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
==============================================================================
--- subversion/trunk/tools/dist/release.py	Fri Dec 26 10:48:21 2025	(r1930866)
+++ subversion/trunk/tools/dist/release.py	Fri Dec 26 11:17:01 2025	(r1930867)
@@ -646,7 +646,7 @@ def create_status_file_on_branch(args):
       print('\nNew STATUS file:')
       print(template.generate(sys.stdout, data))
     else:
-      with open(status_local_path, 'wx') as g:
+      with open(status_local_path, 'x') as g:
         template.generate(g, data)
     run_svn(['add', status_local_path],
             dry_run=args.dry_run)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.