File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2392,7 +2392,7 @@ green_repr(BorrowedGreenlet self)
23922392 PyObject* result;
23932393 int never_started = !self->started () && !self->active ();
23942394
2395- const char * const tp_name = Py_TYPE (self)->tp_name ;
2395+ const char * const tp_name = Py_TYPE (self. borrow () )->tp_name ;
23962396
23972397 if (_green_not_dead (self)) {
23982398 /* XXX: The otid= is almost useless because you can't correlate it to
Original file line number Diff line number Diff line change @@ -990,7 +990,7 @@ namespace greenlet {
990990 " throw() third argument must be a traceback object" );
991991 }
992992
993- if (PyExceptionClass_Check (type)) {
993+ if (PyExceptionClass_Check (type. borrow () )) {
994994 // If we just had a type, we'll now have a type and
995995 // instance.
996996 // The type's refcount will have gone up by one
@@ -1000,7 +1000,7 @@ namespace greenlet {
10001000 PyErr_NormalizeException (&type, &instance, &traceback);
10011001
10021002 }
1003- else if (PyExceptionInstance_Check (type)) {
1003+ else if (PyExceptionInstance_Check (type. borrow () )) {
10041004 /* Raising an instance. The value should be a dummy. */
10051005 if (instance && !instance.is_None ()) {
10061006 throw PyErrOccurred (
Original file line number Diff line number Diff line change @@ -397,8 +397,8 @@ class ThreadState {
397397 }
398398 else if (refs
399399 && refs.size () == 1
400- && PyCFunction_Check (refs.at (0 ))
401- && Py_REFCNT (refs.at (0 )) == 2 ) {
400+ && PyCFunction_Check (refs.at (0 ). borrow () )
401+ && Py_REFCNT (refs.at (0 ). borrow () ) == 2 ) {
402402 assert (refs.REFCNT () == 1 );
403403 // Ok, we found a C method that refers to the
404404 // main greenlet, and its only referenced
@@ -419,7 +419,8 @@ class ThreadState {
419419 if (refs && refs.empty ()) {
420420 // Nope, it can't be found so it won't
421421 // ever be GC'd. Drop it.
422- Py_CLEAR (function_w);
422+ PyObject * tmp = function_w.borrow ();
423+ Py_CLEAR (tmp);
423424 }
424425 }
425426 }
You can’t perform that action at this time.
0 commit comments