Skip to content

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

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
mshabunin:minimal-python-3
Jun 11, 2019
Merged

Added cmake switch to enable limited python API (stage 3)#14736
opencv-pushbot merged 1 commit intoopencv:3.4from
mshabunin:minimal-python-3

Conversation

@mshabunin
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Dead code?


template<>
bool pyopencv_to(PyObject* obj, String& value, const char* name)
bool pyopencv_to(PyObject* obj, String &value, const char* name)
Copy link
Copy Markdown
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
Copy Markdown
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?

${cname} * dst_;
if (pyopencv_${name}_getp(src, dst_))
{
dst = ((pyopencv_${name}_t*)src)->v.dynamicCast<${cname}>();
Copy link
Copy Markdown
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