boostorg / boostorg/python

Division assignment operator (/=) is not exported properly to Python3

未關閉
#317 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
537
分支
223
平均合併
11 小時 22 分鐘
30 天內合併 PR
2

描述

The minimal example I have is for g++8.3.0 and boost1.67 on Ubuntu19.04 (although I have tested boost1.74 on a CentOS7.8 platform).

My understanding of the issue is that when the operator "/=" is exported for Python3, it is binded to \_\_idiv__ and not \_\_itruediv__, therefore causing a crash upon runtime. For Python2, there is no problem observed.

The problem solved by explicitly doing .def("\_\_itruediv__", &Foo::operator/=). Is this a desired behaviour?

PS:
Compiling on Ubuntu19.04 as:
g++ foo.cpp -Wall -Wextra -shared -fPIC -o myModule.so -Wfatal-errors -I/usr/include/python3.7 -lboost_python3 (boost1.67 library and boost1.67-dev installed from packages).

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

最小重現是 foo.cpp;先使用所述的 Boost 和 Python 3 設定編譯它,並檢查匯出 Foo::operator/= 如何對應到 __idiv__ 而非 __itruediv__。完成的標準是 Python 3 呼叫正確的原地真除法方法且不會發生執行階段當機,同時 Python 2 的行為維持不變。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
cpp, python
領域
api
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。