Skip to content

gh-105499: Avoid using functools.reduce() to reconstruct Union objects - #155280

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
Viicos:vp/union-reconstruction
Aug 7, 2026
Merged

gh-105499: Avoid using functools.reduce() to reconstruct Union objects#155280
JelleZijlstra merged 1 commit into
python:mainfrom
Viicos:vp/union-reconstruction

Conversation

@Viicos

@Viicos Viicos commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

As UnionType is Union in 3.14+, we can now just use Union[args] to reconstruct Union objects in typing. No news entry necessary.

Benchmarks

Script 1: isolated construction cost

import timeit
import functools
import operator
import typing

for n in (2, 3, 5, 10, 20, 40, 80):
    types_ = tuple(type(f"T{i}", (), {}) for i in range(n))
    t_reduce = min(timeit.repeat(lambda: functools.reduce(operator.or_, types_), number=20000, repeat=5))
    t_union = min(timeit.repeat(lambda: typing.Union[types_], number=20000, repeat=5))
    print(f"n={n:3d}  reduce(or_): {t_reduce/20000*1e9:9.1f} ns/call   "
          f"Union[tuple]: {t_union/20000*1e9:8.1f} ns/call   "
          f"speedup={t_reduce/t_union:.2f}x")

Results:

members reduce(or_, ...) Union[tuple] speedup
2 448 ns 407 ns 1.10x
3 734 ns 436 ns 1.68x
5 1,521 ns 630 ns 2.42x
10 4,669 ns 862 ns 5.41x
20 13,967 ns 1,388 ns 10.06x
40 45,431 ns 2,119 ns 21.44x
80 161,641 ns 4,533 ns 35.66x
n=  2  reduce(or_):     448.1 ns/call   Union[tuple]:    407.0 ns/call   speedup=1.10x
n=  3  reduce(or_):     733.8 ns/call   Union[tuple]:    436.2 ns/call   speedup=1.68x
n=  5  reduce(or_):    1521.4 ns/call   Union[tuple]:    630.0 ns/call   speedup=2.42x
n= 10  reduce(or_):    4668.7 ns/call   Union[tuple]:    862.4 ns/call   speedup=5.41x
n= 20  reduce(or_):   13966.6 ns/call   Union[tuple]:   1387.7 ns/call   speedup=10.06x
n= 40  reduce(or_):   45430.8 ns/call   Union[tuple]:   2119.1 ns/call   speedup=21.44x
n= 80  reduce(or_):  161641.4 ns/call   Union[tuple]:   4532.7 ns/call   speedup=35.66x

Script 2: end-to-end typing._eval_type() on a Union of n forward refs

import sys
import timeit
import typing
from typing import Union


class A: pass
class B: pass
class C: pass
class D: pass
class E: pass
class F: pass
class G: pass
class H: pass
class I_: pass
class J: pass


ALL = [A, B, C, D, E, F, G, H, I_, J, int, str, float, bytes, complex, bool,
       list, dict, set, tuple]


def make_union_alias(n):
    # Build typing.Union[ForwardRef, ForwardRef, ...] with n string members,
    # forcing typing._eval_type to rebuild the Union from evaluated args.
    names = [cls.__name__ for cls in ALL[:n]]
    ns = {cls.__name__: cls for cls in ALL[:n]}
    alias = Union[tuple(names)]  # each str member becomes a ForwardRef in __args__
    return alias, ns


def bench(label, n, stmt, **kw):
    t = min(timeit.repeat(stmt, number=n, repeat=5, globals={**globals(), **kw}))
    print(f"{label:20s} {t / n * 1e9:9.1f} ns/call  ({n} iters, best of 5)")


if __name__ == "__main__":
    for n in (2, 3, 5, 10, 20):
        alias, ns = make_union_alias(n)
        bench(f"n={n:2d}", 20_000, "typing._eval_type(alias, ns, ns, ())", alias=alias, ns=ns)

Results:

members before (reduce) after (Union[]) speedup
2 7,630 ns 7,995 ns ~flat (noise)
3 10,535 ns 10,052 ns 1.05x
5 17,142 ns 16,047 ns 1.07x
10 35,076 ns 30,732 ns 1.14x
20 74,370 ns 61,373 ns 1.21x
before (reduce/or_):
n= 2                    7629.6 ns/call  (20000 iters, best of 5)
n= 3                   10534.8 ns/call  (20000 iters, best of 5)
n= 5                   17141.8 ns/call  (20000 iters, best of 5)
n=10                   35075.9 ns/call  (20000 iters, best of 5)
n=20                   74370.2 ns/call  (20000 iters, best of 5)

after (Union[ev_args]):
n= 2                    7994.7 ns/call  (20000 iters, best of 5)
n= 3                   10052.3 ns/call  (20000 iters, best of 5)
n= 5                   16046.6 ns/call  (20000 iters, best of 5)
n=10                   30731.6 ns/call  (20000 iters, best of 5)
n=20                   61373.3 ns/call  (20000 iters, best of 5)

@Viicos

Viicos commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Maybe we don't want this if Union[...] is expected to be deprecated (#154480).

@JelleZijlstra

Copy link
Copy Markdown
Member

I think we'll continue to support at least variadic Union; I see the soft deprecation more as discouraging people from writing Union[A, B].

This replacement isn't exactly equivalent in all cases I believe. Does that matter?

@Viicos

Viicos commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

This replacement isn't exactly equivalent in all cases I believe. Does that matter?

Hum do you have specific examples where it wouldn't be equivalent? Only difference I'm aware of between functools.reduce(or_, args) and Union[args] is when args contains a bare string, in which case <type> | 'forward' results in a TypeError, while it works for the latter.

Edit:

import typing

class NotAType:
    pass

instance = NotAType()

def f(x: 'typing.Union[int, "junk"]'):
    pass

ns = {'typing': typing, 'int': int, 'junk': instance}
hints = typing.get_type_hints(f, ns, ns)
print(hints)
# main: TypeError: unsupported operand type(s) for |: 'type' and 'NotAType'
# this PR: {'x': int | <__main__.NotAType object at 0x10626f620>}

While contrived, seems like we improve the current state?

@JelleZijlstra

Copy link
Copy Markdown
Member

Just in general that one invokes the | operator (which might do anything) and another directly makes a Union. Though of course at this point we know we (mostly) only have types, so it's probably fine.

@JelleZijlstra
JelleZijlstra enabled auto-merge (squash) August 7, 2026 01:52
@JelleZijlstra
JelleZijlstra merged commit cfcbfe4 into python:main Aug 7, 2026
51 checks passed
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Fedora Stable Clang Installed 3.x (tier-2) has failed when building commit cfcbfe4.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/350/builds/10209) and take a look at the build logs.
  4. Check if the failure is related to this commit (cfcbfe4) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/350/builds/10209

Summary of the results of the build (if available):

Click to see traceback logs
Note: switching to 'cfcbfe45bc4c013211b2758c5506232615315d6b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at cfcbfe45bc4c0 gh-105499: Avoid using `functools.reduce()` to reconstruct `Union` objects (#155280)
Switched to and reset branch 'main'

In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:283:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  283 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:290:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  290 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:436:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  436 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:443:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  443 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:549:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  549 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:558:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  558 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:580:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  580 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:591:9: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  591 |         CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |         ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:688:11: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  688 |           CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |           ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:733:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  733 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:759:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  759 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:770:9: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  770 |         CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |         ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:783:11: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  783 |           CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |           ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:928:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  928 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:941:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  941 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:958:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  958 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
./Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:965:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  965 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:1200:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
 1200 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ./Modules/expat/xmltok.c:309:
./Modules/expat/xmltok_impl.c:1220:11: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
 1220 |           CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |           ^
./Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
./Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
19 warnings generated.

install: error copying 'libpython3.16.a' to '/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/target/lib/libpython3.16.a': No space left on device
make: *** [Makefile:2593: altbininstall] Error 1
make: *** Waiting for unfinished jobs....
install: error copying './Include/dictobject.h' to '/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/target/include/python3.16/dictobject.h': No space left on device
make: *** [Makefile:3072: inclinstall] Error 1
ln: failed to create symbolic link 'build/lib.linux-x86_64-3.16/_codecs_iso2022.cpython-316-x86_64-linux-gnu.so': No space left on device
make: *** [Makefile:1699: sharedmods] Error 1

@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Fedora Stable LTO + PGO 3.x (tier-1) has failed when building commit cfcbfe4.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/29/builds/10585) and take a look at the build logs.
  4. Check if the failure is related to this commit (cfcbfe4) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/29/builds/10585

Summary of the results of the build (if available):

Click to see traceback logs
Note: switching to 'cfcbfe45bc4c013211b2758c5506232615315d6b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at cfcbfe45bc4c0 gh-105499: Avoid using `functools.reduce()` to reconstruct `Union` objects (#155280)
Switched to and reset branch 'main'

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:3475: clean-retain-profile] Error 1 (ignored)
/tmp/ccAbCh3h.s: Assembler messages:
/tmp/ccAbCh3h.s: Fatal error: Python/ceval.o: No space left on device
make[2]: *** [Makefile:3391: Python/ceval.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/tmp/ccqUlVUQ.s: Assembler messages:
/tmp/ccqUlVUQ.s: Fatal error: can't write 3911 bytes to section .gnu.lto_.decls.1c040430b4657d63 of Objects/unicodeobject.o: 'No space left on device'
/tmp/ccqUlVUQ.s: Fatal error: Objects/unicodeobject.o: No such file or directory
make[2]: *** [Makefile:3381: Objects/unicodeobject.o] Error 1
/tmp/ccOnUhbC.s: Assembler messages:
/tmp/ccOnUhbC.s: Fatal error: can't write 26 bytes to section .text of Modules/_io/textio.o: 'No space left on device'
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
/tmp/ccOnUhbC.s: Fatal error: Modules/_io/textio.o: No such file or directory
make[2]: *** [Makefile:3958: Modules/_io/textio.o] Error 1
/tmp/cc8A2OI3.s: Assembler messages:
/tmp/cc8A2OI3.s: Fatal error: can't write 39 bytes to section .text of Modules/timemodule.o: 'No space left on device'
/tmp/cc8A2OI3.s: Fatal error: Modules/timemodule.o: No such file or directory
make[2]: *** [Makefile:3969: Modules/timemodule.o] Error 1
/tmp/ccGBXmtZ.s: Assembler messages:
/tmp/ccGBXmtZ.s: Fatal error: can't write 18 bytes to section .text of Modules/itertoolsmodule.o: 'No space left on device'
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
/tmp/ccGBXmtZ.s: Fatal error: Modules/itertoolsmodule.o: No such file or directory
make[2]: *** [Makefile:3961: Modules/itertoolsmodule.o] Error 1
/tmp/ccfuKFzG.s: Assembler messages:
/tmp/ccfuKFzG.s: Fatal error: can't write 18 bytes to section .text of Modules/_threadmodule.o: 'No space left on device'
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
/tmp/ccfuKFzG.s: Fatal error: Modules/_threadmodule.o: No such file or directory
make[2]: *** [Makefile:3967: Modules/_threadmodule.o] Error 1
/tmp/ccwtVLyL.s: Assembler messages:
/tmp/ccwtVLyL.s: Fatal error: can't write 18 bytes to section .text of Python/Python-ast.o: 'No space left on device'
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
/tmp/ccwtVLyL.s: Fatal error: Python/Python-ast.o: No such file or directory
make[2]: *** [Makefile:3381: Python/Python-ast.o] Error 1
/tmp/ccXcUet3.s: Assembler messages:
/tmp/ccXcUet3.s: Fatal error: can't write 18 bytes to section .text of Modules/posixmodule.o: 'No space left on device'
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
/tmp/ccXcUet3.s: Fatal error: Modules/posixmodule.o: No such file or directory
make[2]: *** [Makefile:3937: Modules/posixmodule.o] Error 1
/tmp/ccZLZGHs.s: Assembler messages:
/tmp/ccZLZGHs.s: Fatal error: can't write 18 bytes to section .text of Modules/_sre/sre.o: 'No space left on device'
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
as: BFD version 2.46.1-1.fc44 assertion fail ../../bfd/elf.c:3571
/tmp/ccZLZGHs.s: Fatal error: Modules/_sre/sre.o: No such file or directory
make[2]: *** [Makefile:3963: Modules/_sre/sre.o] Error 1
make[1]: *** [Makefile:997: profile-gen-stamp] Error 2
make: *** [Makefile:1009: profile-run-stamp] Error 2

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make: [Makefile:3475: clean-retain-profile] Error 1 (ignored)

@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Fedora Stable LTO 3.x (tier-1) has failed when building commit cfcbfe4.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/271/builds/9356) and take a look at the build logs.
  4. Check if the failure is related to this commit (cfcbfe4) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/271/builds/9356

Summary of the results of the build (if available):

Click to see traceback logs
Note: switching to 'cfcbfe45bc4c013211b2758c5506232615315d6b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at cfcbfe45bc4c0 gh-105499: Avoid using `functools.reduce()` to reconstruct `Union` objects (#155280)
Switched to and reset branch 'main'

cat: write error: No space left on device
configure: error: could not make ./config.status
sort: write failed: 'standard output': No space left on device
sort: write error
./configure: line 42: echo: write error: No space left on device
./configure: line 44: printf: No space left on device
./configure: line 44: printf: write error: No space left on device
./configure: line 47: echo: write error: No space left on device
sort: write failed: 'standard output': No space left on device
sort: write error
./configure: line 56: echo: write error: No space left on device
./configure: line 75: printf: No space left on device
./configure: line 75: printf: write error: No space left on device
./configure: line 78: echo: write error: No space left on device
cat: write error: No space left on device
./configure: line 80: echo: write error: No space left on device
./configure: line 84: printf: write error: No space left on device

make: *** No rule to make target 'distclean'.  Stop.

@Viicos
Viicos deleted the vp/union-reconstruction branch August 7, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants