pybind / pybind11_abseil

Pybind11 bindings for the Abseil C++ Common Libraries
Other
24 stars 14 forks source link

Deprecated Abseil types ie.(`Breakdown`) in use #11

Open teadetime opened 1 year ago

teadetime commented 1 year ago

It appears that pybind11_abseil uses deprecated types. ie. Breakdown, From_Datetime. Will/when will this be updated?

These issues seem to appear even when using the 20230802.0 tag of abseil-cpp as specified in the WORKSPACE file.

For a more complete example of the deprecated features see a failed build:

external/pybind11_abseil/pybind11_abseil/absl_casters.h:132:33: error: 'Breakdown' is deprecated: Use `absl::TimeZone::CivilInfo`. [-Werror=deprecated-declarations]
  132 | constexpr absl::Time::Breakdown kDatetimeInfiniteFuture = {
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:805:62: note: declared here
  805 |   struct ABSL_DEPRECATED("Use `absl::TimeZone::CivilInfo`.") Breakdown {
      |                                                              ^~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h:133:57: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::weekday' [-Werror=missing-field-initializers]
  133 |     9999, 12, 31, 23, 59, 59, absl::Microseconds(999999)};
      |                                                         ^
external/pybind11_abseil/pybind11_abseil/absl_casters.h:133:57: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::yearday' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:133:57: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::offset' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:133:57: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::is_dst' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:133:57: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::zone_abbr' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:134:33: error: 'Breakdown' is deprecated: Use `absl::TimeZone::CivilInfo`. [-Werror=deprecated-declarations]
  134 | constexpr absl::Time::Breakdown kDatetimeInfinitePast = {
      |                                 ^~~~~~~~~~~~~~~~~~~~~
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:805:62: note: declared here
  805 |   struct ABSL_DEPRECATED("Use `absl::TimeZone::CivilInfo`.") Breakdown {
      |                                                              ^~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h:135:43: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::weekday' [-Werror=missing-field-initializers]
  135 |     1, 1, 1, 0, 0, 0, absl::ZeroDuration()};
      |                                           ^
external/pybind11_abseil/pybind11_abseil/absl_casters.h:135:43: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::yearday' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:135:43: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::offset' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:135:43: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::is_dst' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:135:43: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::zone_abbr' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:147:72: error: 'Breakdown' is deprecated [-Werror=deprecated-declarations]
  147 |                                 const absl::Time::Breakdown& bd_special) {
      |                                                                        ^
external/pybind11_abseil/pybind11_abseil/absl_casters.h:147:72: error: 'Breakdown' is deprecated [-Werror=deprecated-declarations]
external/pybind11_abseil/pybind11_abseil/absl_casters.h: In member function 'bool pybind11::detail::type_caster<absl::lts_20230802::Time>::load(pybind11::handle, bool)':
external/pybind11_abseil/pybind11_abseil/absl_casters.h:233:29: error: 'Breakdown' is deprecated: Use `absl::TimeZone::CivilInfo`. [-Werror=deprecated-declarations]
  233 |       absl::Time::Breakdown bd_py = {
      |                             ^~~~~
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:805:62: note: declared here
  805 |   struct ABSL_DEPRECATED("Use `absl::TimeZone::CivilInfo`.") Breakdown {
      |                                                              ^~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h:240:73: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::weekday' [-Werror=missing-field-initializers]
  240 |           absl::Microseconds(PyDateTime_DATE_GET_MICROSECOND(src.ptr()))};
      |                                                                         ^
external/pybind11_abseil/pybind11_abseil/absl_casters.h:240:73: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::yearday' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:240:73: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::offset' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:240:73: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::is_dst' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:240:73: error: missing initializer for member 'absl::lts_20230802::Time::Breakdown::zone_abbr' [-Werror=missing-field-initializers]
external/pybind11_abseil/pybind11_abseil/absl_casters.h:271:21: error: 'absl::lts_20230802::Time absl::lts_20230802::FromDateTime(int64_t, int, int, int, int, int, absl::lts_20230802::TimeZone)' is deprecated: Use `absl::FromCivil(CivilSecond, TimeZone)`. [-Werror=deprecated-declarations]
  271 |       value = absl::FromDateTime(
      |                     ^~~~~~~~~~~~
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:1384:13: note: declared here
 1384 | inline Time FromDateTime(int64_t year, int mon, int day, int hour, int min,
      |             ^~~~~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h:273:72: error: 'absl::lts_20230802::Time absl::lts_20230802::FromDateTime(int64_t, int, int, int, int, int, absl::lts_20230802::TimeZone)' is deprecated: Use `absl::FromCivil(CivilSecond, TimeZone)`. [-Werror=deprecated-declarations]
  273 |           PyDateTime_GET_DAY(src.ptr()), 0, 0, 0, absl::LocalTimeZone());
      |                                                                        ^
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:1384:13: note: declared here
 1384 | inline Time FromDateTime(int64_t year, int mon, int day, int hour, int min,
      |             ^~~~~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h:273:72: error: 'absl::lts_20230802::Time absl::lts_20230802::FromDateTime(int64_t, int, int, int, int, int, absl::lts_20230802::TimeZone)' is deprecated: Use `absl::FromCivil(CivilSecond, TimeZone)`. [-Werror=deprecated-declarations]
  273 |           PyDateTime_GET_DAY(src.ptr()), 0, 0, 0, absl::LocalTimeZone());
      |                                                                        ^
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:1384:13: note: declared here
 1384 | inline Time FromDateTime(int64_t year, int mon, int day, int hour, int min,
      |             ^~~~~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h: In static member function 'static pybind11::handle pybind11::detail::type_caster<absl::lts_20230802::Time>::cast(const absl::lts_20230802::Time&, pybind11::return_value_policy, pybind11::handle)':
external/pybind11_abseil/pybind11_abseil/absl_casters.h:295:27: error: 'Breakdown' is deprecated: Use `absl::TimeZone::CivilInfo`. [-Werror=deprecated-declarations]
  295 |     absl::Time::Breakdown t = src.In(absl::UTCTimeZone());
      |                           ^
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 from pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:805:62: note: declared here
  805 |   struct ABSL_DEPRECATED("Use `absl::TimeZone::CivilInfo`.") Breakdown {
      |                                                              ^~~~~~~~~
In file included from pybind_example.cc:21:
external/pybind11_abseil/pybind11_abseil/absl_casters.h:295:57: error: 'absl::lts_20230802::Time::Breakdown absl::lts_20230802::Time::In(absl::lts_20230802::TimeZone) const' is deprecated: Use `absl::TimeZone::At(Time)`. [-Werror=deprecated-declarations]
  295 |     absl::Time::Breakdown t = src.In(absl::UTCTimeZone());
      |                                                         ^
In file included from external/com_google_absl/absl/time/clock.h:26,
                 from external/com_google_absl/absl/synchronization/internal/kernel_timeout.h:30,
                 from external/com_google_absl/absl/synchronization/mutex.h:74,
                 from external/com_google_absl/absl/strings/internal/cordz_info.h:31,
                 from external/com_google_absl/absl/strings/cord.h:91,
                 from external/com_google_absl/absl/status/internal/status_internal.h:23,
                 from external/com_google_absl/absl/status/status.h:59,
                 from external/pybind11_abseil/pybind11_abseil/status_caster.h:11,
                 from external/pybind11_abseil/pybind11_abseil/status_casters.h:20,
                 pybind_example.cc:16:
external/com_google_absl/absl/time/time.h:833:13: note: declared here
  833 |   Breakdown In(TimeZone tz) const;
      |             ^~
rwgk commented 1 year ago

I'm aware of this from working on the code in Apr/May this year, but it'll be a ~3 day project to change the implementation: currently I have to do this in two places, here, and internal absl/python code. Therefore it's way down the list of priorities.

If you like to help changing the implementation just here, I'll look at a PR here quickly. I think we can go through all review and test steps here as usual, only at the end I have to manually import into the Google codebase, from where it will then get auto-exported. A little cumbersome but not a lot of work, and it'll preserve the original author attribution.