[BUG] Weird issue only on manylinux1 with numpy
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Dumping this here since I need to fix this and move on for now (it's an issue in Awkward). Only on manylinux1 (2010 is fine), the following code produces a really weird result:
py::print(typeid(obj.ptr()).name());
py::print(typeid(py::module::import("numpy").attr("newaxis").ptr()).name());
py::print(typeid(Py_None).name());
py::print((long long) obj.ptr());
py::print((long long) py::module::import("numpy").attr("newaxis").ptr());
py::print((long long) Py_None);
py::print(obj.is(py::module::import("numpy").attr("newaxis")));
py::print(obj.ptr() == py::module::import("numpy").attr("newaxis").ptr());
Prints:
P7_object
P7_object
P7_object
8098416
8098416
8098416
False
True
Why is obj.is(py::module::import("numpy").attr("newaxis")) False? It's the same memory location as Py_None, but somehow is not "is" identical, only here in pybind11.
PS: obj is None, numpy.newaxis is None.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied C++ reproducer with numpy under manylinux1 and manylinux2010, comparing the reported pointer values and identity results. Then inspect pybind11's implementation of obj.is to trace the platform-specific behavior. Done means identifying the cause and verifying a fix or documented resolution for the None and numpy.newaxis identity comparison.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, numpy, python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100