Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mypyc/lib-rt/exc_ops.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "pythoncapi_compat.h"

// Exception related primitive operations
//
// These are registered in mypyc.primitives.exc_ops.
Expand All @@ -24,7 +26,7 @@ void CPy_Reraise(void) {
}

void CPyErr_SetObjectAndTraceback(PyObject *type, PyObject *value, PyObject *traceback) {
if (!PyType_Check(type) && value == Py_None) {
if (!PyType_Check(type) && Py_IsNone(value)) {
// The first argument must be an exception instance
value = type;
type = (PyObject *)Py_TYPE(value);
Expand Down
4 changes: 3 additions & 1 deletion mypyc/lib-rt/librt_internal.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "pythoncapi_compat.h"

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdint.h>
Expand Down Expand Up @@ -245,7 +247,7 @@ write_bool(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwname
PyErr_SetString(PyExc_TypeError, "value must be a bool");
return NULL;
}
if (unlikely(write_bool_internal(data, value == Py_True) == CPY_NONE_ERROR)) {
if (unlikely(write_bool_internal(data, Py_IsTrue(value)) == CPY_NONE_ERROR)) {
return NULL;
}
Py_INCREF(Py_None);
Expand Down
4 changes: 3 additions & 1 deletion mypyc/lib-rt/misc_ops.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "pythoncapi_compat.h"

// Misc primitive operations + C helpers
//
// These are registered in mypyc.primitives.misc_ops.
Expand Down Expand Up @@ -750,7 +752,7 @@ CPy_Super(PyObject *builtins, PyObject *self) {

static bool import_single(PyObject *mod_id, PyObject **mod_static,
PyObject *globals_id, PyObject *globals_name, PyObject *globals) {
if (*mod_static == Py_None) {
if (Py_IsNone(*mod_static)) {
CPyModule *mod = PyImport_Import(mod_id);
if (mod == NULL) {
return false;
Expand Down
Loading