Skip to content
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

2.24.0: not ready for pyupgrade --py39-plus (fails on linking DSO) #1462

Open
kloczek opened this issue Sep 21, 2024 · 4 comments
Open

2.24.0: not ready for pyupgrade --py39-plus (fails on linking DSO) #1462

kloczek opened this issue Sep 21, 2024 · 4 comments

Comments

@kloczek
Copy link
Contributor

kloczek commented Sep 21, 2024

Next month python 3.8mwill be EOSed.
I've tested patch generated by pyupgrade --py39-plus and looks like with that patch build fails on linking with

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
* Building wheel...
Running `maturin pep517 build-wheel -i /usr/bin/python3 --compatibility off`
📦 Including license file "/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/LICENSE"
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
🐍 Found CPython 3.10 at /usr/bin/python3
📡 Using build options features, bindings from pyproject.toml
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling target-lexicon v0.12.14
   Compiling python3-dll-a v0.2.10
   Compiling once_cell v1.19.0
   Compiling autocfg v1.3.0
   Compiling stable_deref_trait v1.2.0
   Compiling libc v0.2.155
   Compiling heck v0.5.0
   Compiling version_check v0.9.5
   Compiling litemap v0.7.3
   Compiling writeable v0.5.5
   Compiling rustversion v1.0.17
   Compiling memchr v2.7.4
   Compiling icu_locid_transform_data v1.5.0
   Compiling radium v0.7.0
   Compiling cfg-if v1.0.0
   Compiling tinyvec_macros v0.1.1
   Compiling static_assertions v1.1.0
   Compiling smallvec v1.13.2
   Compiling icu_properties_data v1.5.0
   Compiling serde v1.0.209
   Compiling tap v1.0.1
   Compiling serde_json v1.0.128
   Compiling indoc v2.0.5
   Compiling write16 v1.0.0
   Compiling percent-encoding v2.3.1
   Compiling unindent v0.2.3
   Compiling utf8_iter v1.0.4
   Compiling hashbrown v0.14.5
   Compiling unicode-bidi v0.3.15
   Compiling icu_normalizer_data v1.5.0
   Compiling funty v2.0.0
   Compiling utf16_iter v1.0.5
   Compiling zerocopy v0.7.34
   Compiling regex-syntax v0.8.4
   Compiling equivalent v1.0.1
   Compiling ryu v1.0.18
   Compiling itoa v1.0.11
   Compiling uuid v1.10.0
   Compiling hex v0.4.3
   Compiling base64 v0.22.1
   Compiling lexical-util v0.8.5
   Compiling tinyvec v1.6.1
   Compiling wyz v0.5.1
   Compiling form_urlencoded v1.2.1
   Compiling aho-corasick v1.1.3
   Compiling bitvec v1.0.1
   Compiling indexmap v2.2.6
   Compiling lexical-parse-integer v0.8.6
   Compiling unicode-normalization v0.1.23
   Compiling lexical-parse-float v0.8.5
   Compiling quote v1.0.36
   Compiling syn v2.0.68
   Compiling ahash v0.8.11
   Compiling idna v0.5.0
   Compiling getrandom v0.2.15
   Compiling num-traits v0.2.19
   Compiling memoffset v0.9.1
   Compiling url v2.5.2
   Compiling regex-automata v0.4.7
   Compiling pyo3-build-config v0.22.2
   Compiling num-integer v0.1.46
   Compiling num-bigint v0.4.6
   Compiling regex v1.10.6
   Compiling synstructure v0.13.1
   Compiling pyo3-ffi v0.22.2
   Compiling pyo3-macros-backend v0.22.2
   Compiling pyo3 v0.22.2
   Compiling jiter v0.5.0
   Compiling pydantic-core v2.24.0 (/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0)
error: failed to run custom build command for `pydantic-core v2.24.0 (/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/target/release/build/pydantic-core-176bfdeef7d000ae/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-check-cfg=cfg(Py_LIMITED_API)
  cargo:rustc-check-cfg=cfg(PyPy)
  cargo:rustc-check-cfg=cfg(GraalPy)
  cargo:rustc-check-cfg=cfg(py_sys_config, values("Py_DEBUG", "Py_REF_DEBUG", "Py_TRACE_REFS", "COUNT_ALLOCS"))
  cargo:rustc-check-cfg=cfg(invalid_from_utf8_lint)
  cargo:rustc-check-cfg=cfg(pyo3_disable_reference_pool)
  cargo:rustc-check-cfg=cfg(pyo3_leak_on_drop_without_reference_pool)
  cargo:rustc-check-cfg=cfg(diagnostic_namespace)
  cargo:rustc-check-cfg=cfg(c_str_lit)
  cargo:rustc-check-cfg=cfg(Py_3_7)
  cargo:rustc-check-cfg=cfg(Py_3_8)
  cargo:rustc-check-cfg=cfg(Py_3_9)
  cargo:rustc-check-cfg=cfg(Py_3_10)
  cargo:rustc-check-cfg=cfg(Py_3_11)
  cargo:rustc-check-cfg=cfg(Py_3_12)
  cargo:rustc-check-cfg=cfg(Py_3_13)
  cargo:rustc-cfg=Py_3_6
  cargo:rustc-cfg=Py_3_7
  cargo:rustc-cfg=Py_3_8
  cargo:rustc-cfg=Py_3_9
  cargo:rustc-cfg=Py_3_10
  cargo:rustc-check-cfg=cfg(has_coverage_attribute)
  cargo:rustc-check-cfg=cfg(specified_profile_use)
  cargo:rerun-if-changed=python/pydantic_core/core_schema.py
  cargo:rerun-if-changed=generate_self_schema.py

  --- stderr
  Traceback (most recent call last):
    File "/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/generate_self_schema.py", line 247, in <module>
      main()
    File "/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/generate_self_schema.py", line 217, in main
      value = get_schema(s, definitions)
    File "/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/generate_self_schema.py", line 57, in get_schema
      return type_dict_schema(obj, definitions)
    File "/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/generate_self_schema.py", line 156, in type_dict_schema
      raise ValueError(f'Unknown Schema forward ref: {fr_arg}')
  ValueError: Unknown Schema forward ref: list[CoreSchema]
  thread 'main' panicked at build.rs:29:9:
  generate_self_schema.py failed with exit status: 1
  stack backtrace:
     0:     0x560bdf04ef75 - std::backtrace_rs::backtrace::libunwind::trace::h5c85e557799ed486
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
     1:     0x560bdf04ef75 - std::backtrace_rs::backtrace::trace_unsynchronized::ha97b107185df65bb
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x560bdf04ef75 - std::sys::backtrace::_print_fmt::h490acf9e9b8c6eb2
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/sys/backtrace.rs:65:5
     3:     0x560bdf04ef75 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9c32407e5a23c650
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/sys/backtrace.rs:40:26
     4:     0x560bdf06f17b - core::fmt::rt::Argument::fmt::hae324c745842212e
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/fmt/rt.rs:173:76
     5:     0x560bdf06f17b - core::fmt::write::h8e3a6cb8df1f9a95
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/fmt/mod.rs:1182:21
     6:     0x560bdf04ccef - std::io::Write::write_fmt::h83bcab37323a9399
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/io/mod.rs:1827:15
     7:     0x560bdf0500c1 - std::sys::backtrace::BacktraceLock::print::hd3c35caa6032e632
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/sys/backtrace.rs:43:9
     8:     0x560bdf0500c1 - std::panicking::default_hook::{{closure}}::hd3c6083514eb2656
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:269:22
     9:     0x560bdf04fd9c - std::panicking::default_hook::h94d20e9291e6eb42
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:296:9
    10:     0x560bdf050691 - std::panicking::rust_panic_with_hook::hfa25182080856bef
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:800:13
    11:     0x560bdf050587 - std::panicking::begin_panic_handler::{{closure}}::h2fc3fd5367175cd3
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:674:13
    12:     0x560bdf04f439 - std::sys::backtrace::__rust_end_short_backtrace::h877093daaa72bd28
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/sys/backtrace.rs:168:18
    13:     0x560bdf050214 - rust_begin_unwind
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:665:5
    14:     0x560bdf017f33 - core::panicking::panic_fmt::hfc4c464a0d356173
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/panicking.rs:74:14
    15:     0x560bdf019cd8 - build_script_build::generate_self_schema::hf9f929900624c562
                                 at /home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/build.rs:29:9
    16:     0x560bdf019cd8 - build_script_build::main::ha5db4a51bcd9603f
                                 at /home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/build.rs:48:5
    17:     0x560bdf018703 - core::ops::function::FnOnce::call_once::h4e11fd2c02563b95
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/ops/function.rs:250:5
    18:     0x560bdf018703 - std::sys::backtrace::__rust_begin_short_backtrace::h0b129e115204002e
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/sys/backtrace.rs:152:18
    19:     0x560bdf0186f9 - std::rt::lang_start::{{closure}}::hd691eceb39629f76
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/rt.rs:162:18
    20:     0x560bdf0490f0 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h90440e1dec31addc
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/ops/function.rs:284:13
    21:     0x560bdf0490f0 - std::panicking::try::do_call::h864c0af700b810b6
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:557:40
    22:     0x560bdf0490f0 - std::panicking::try::h81dc1c4c7a744be2
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:521:19
    23:     0x560bdf0490f0 - std::panic::catch_unwind::hce4947710c9959a6
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panic.rs:350:14
    24:     0x560bdf0490f0 - std::rt::lang_start_internal::{{closure}}::hb8ca788eb716154b
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/rt.rs:141:48
    25:     0x560bdf0490f0 - std::panicking::try::do_call::hbe20672d94e23c41
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:557:40
    26:     0x560bdf0490f0 - std::panicking::try::h08906107fe8c4aae
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panicking.rs:521:19
    27:     0x560bdf0490f0 - std::panic::catch_unwind::h20cf014a4ed35f8b
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/panic.rs:350:14
    28:     0x560bdf0490f0 - std::rt::lang_start_internal::he74de233149dbe8b
                                 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/rt.rs:141:20
    29:     0x560bdf019e3f - main
    30:     0x7f6aa2e461c8 - __libc_start_call_main
    31:     0x7f6aa2e4628b - __libc_start_main@GLIBC_2.2.5
    32:     0x560bdf018625 - _start
    33:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.10-64bit" PYO3_PYTHON="/usr/bin/python3" PYTHON_SYS_EXECUTABLE="/usr/bin/python3" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/tkloczko/rpmbuild/BUILD/pydantic-core-2.24.0/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`
Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/usr/bin/python3', '--compatibility', 'off'] returned non-zero exit status 1

ERROR Backend subprocess exited when trying to invoke build_wheel
@davidhewitt
Copy link
Contributor

The build fails because generate_self_schema.py needs updating similar to what I did in this PR: #1279

@kloczek
Copy link
Contributor Author

kloczek commented Oct 1, 2024

I wonder is it would be possible to plug apply such changes automatically directly under pyupgrade?
Did you try to discuss that with pyupgrade maintainers? 🤔

@davidhewitt
Copy link
Contributor

I didn't look further 😬

@kloczek
Copy link
Contributor Author

kloczek commented Oct 1, 2024

I didn't look further 😬

Please try to find some piece of time and explain that in pyupgrade kind of RFE ticket. 🙏
On first look it seems like those changes can be done automatically.
I'm asking because more that only this project probably has similar issue ant may save a lot of time if pyupgrade will be able to apply necessary changes on use --py39-plus param.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants