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

Python: Fix ODR Violation #1521

Merged
merged 1 commit into from
Aug 20, 2023
Merged

Python: Fix ODR Violation #1521

merged 1 commit into from
Aug 20, 2023

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Aug 20, 2023

In pybind11 (and nanobind), auxiliary headers and PYBIND11_MAKE_OPAQUE definitions for distributed modules need to be included in every translation unit. Otherwise, a one-definition-rule violation occurs, which is undefined behavior.

Introduces a common Python helper header that must be used in all Python-binding related .cpp files.

@ax3l ax3l added this to the 0.15.3 milestone Aug 20, 2023
@ax3l ax3l requested a review from franzpoeschel August 20, 2023 01:27
@ax3l ax3l mentioned this pull request Aug 20, 2023
@ax3l ax3l force-pushed the fix-pybind11-odr branch 4 times, most recently from 3e8c9d3 to f559677 Compare August 20, 2023 01:36
In pybind11 (and nanobind), auxiliary headers and
`PYBIND11_MAKE_OPAQUE` definitions for distributed modules need to be
included in every translation unit. Otherwise, a one-definition-rule
violation occurs, which is undefined behavior.
@ax3l ax3l force-pushed the fix-pybind11-odr branch from f559677 to 4a22494 Compare August 20, 2023 01:39
@ax3l ax3l merged commit acf1c11 into openPMD:dev Aug 20, 2023
@ax3l ax3l deleted the fix-pybind11-odr branch August 20, 2023 03:54
eschnett added a commit to eschnett/openPMD-api that referenced this pull request Sep 5, 2023
* dev:
  Fix CMake: HDF5 Libs are PUBLIC (openPMD#1520)
  Fix `chmod` in `download_samples.sh` (openPMD#1518)
  CI: Old CTest (openPMD#1519)
  Python: Fix ODR Violation (openPMD#1521)
  replace extent in weighting and displacement (openPMD#1510)
  CMake: Warn and Continue on Empty HDF5_VERSION (openPMD#1512)
  Replace openPMD_Datatypes global with function (openPMD#1509)
  Streaming examples: Set WAN as default transport (openPMD#1511)
  TOML Backend (openPMD#1436)
  make it possible to manually set chunks when loading dask arrays (openPMD#1477)
  [pre-commit.ci] pre-commit autoupdate (openPMD#1504)
  Optional debugging output for AbstractIOHandlerImpl::flush() (openPMD#1495)
  Python: 3.8+ (openPMD#1502)

# Conflicts:
#	.github/workflows/linux.yml
#	src/binding/python/Series.cpp
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.

2 participants