Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added cmake switch to enable limited python API (stage 3) #14736

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

Merged
merged 1 commit into from
Jun 11, 2019

Conversation

mshabunin
Copy link
Contributor

@mshabunin mshabunin commented Jun 6, 2019

Supersedes #14428 and #14120

This pullrequest changes

cmake option "PYTHON3_LIMITED_API" will enable limited API

Details: PEP-0384

@mshabunin mshabunin force-pushed the minimal-python-3 branch 2 times, most recently from 5f7548a to f4093d0 Compare June 7, 2019 13:19
static PyObject* pyopencv_##NAME##_repr(PyObject* self) \
{ \
char str[1000]; \
sprintf(str, "<"#NAME" %p>", self); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snprintf with sizeof(str)

// Debug module load:
//
// else \
// { \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code?

@@ -741,16 +679,18 @@ PyObject* pyopencv_from(const String& value)
}

template<>
bool pyopencv_to(PyObject* obj, String& value, const char* name)
bool pyopencv_to(PyObject* obj, String &value, const char* name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, What coding style binds reference & symbol to variable name instead of type? In case of return value type?


gen_template_check_self_algo = Template(""" $cname* _self_ = NULL;
if(PyObject_TypeCheck(self, &pyopencv_${name}_Type))
_self_ = dynamic_cast<$cname*>(${amp}((pyopencv_${name}_t*)self)->v.get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does TypeCheck() allows to drop dynamic_cast completely?

{
dst = ((pyopencv_${name}_t*)src)->v.dynamicCast<${cname}>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same note about dynamic_cast

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

Successfully merging this pull request may close these issues.

3 participants