A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/e004c8bb3f26af6a45c86fd885d29af928074ff2 below:

Add reference leak check to Python timestamp_test and duration_test. … · protocolbuffers/protobuf@e004c8b · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+10

-4

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+10

-4

lines changed Original file line number Diff line number Diff line change

@@ -12,11 +12,13 @@

12 12

import unittest

13 13 14 14

from google.protobuf import duration

15 +

from google.protobuf.internal import testing_refleaks

15 16

from google.protobuf.internal import well_known_types_test_pb2

16 17 17 18

from google.protobuf import duration_pb2

18 19 19 20 21 +

@testing_refleaks.TestCase

20 22

class DurationTest(unittest.TestCase):

21 23 22 24

def test_duration_integer_conversion(self):

Original file line number Diff line number Diff line change

@@ -12,11 +12,13 @@

12 12

import unittest

13 13 14 14

from google.protobuf import timestamp

15 +

from google.protobuf.internal import testing_refleaks

15 16

from google.protobuf.internal import well_known_types_test_pb2

16 17 17 18

from google.protobuf import timestamp_pb2

18 19 19 20 21 +

@testing_refleaks.TestCase

20 22

class TimestampTest(unittest.TestCase):

21 23 22 24

def test_timestamp_integer_conversion(self):

Original file line number Diff line number Diff line change

@@ -2641,11 +2641,11 @@ int SetFieldValue(CMessage* self, const FieldDescriptor* field_descriptor,

2641 2641

} else if (field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {

2642 2642

if (field_descriptor->message_type()->well_known_type() !=

2643 2643

Descriptor::WELLKNOWNTYPE_UNSPECIFIED) {

2644 -

PyObject* sub_message = GetFieldValue(self, field_descriptor);

2645 -

if (PyObject_HasAttrString(sub_message, "_internal_assign")) {

2644 +

ScopedPyObjectPtr sub_message(GetFieldValue(self, field_descriptor));

2645 +

if (PyObject_HasAttrString(sub_message.get(), "_internal_assign")) {

2646 2646

AssureWritable(self);

2647 -

ScopedPyObjectPtr ok(

2648 -

PyObject_CallMethod(sub_message, "_internal_assign", "O", value));

2647 +

ScopedPyObjectPtr ok(PyObject_CallMethod(

2648 +

sub_message.get(), "_internal_assign", "O", value));

2649 2649

if (ok.get() == nullptr) {

2650 2650

return -1;

2651 2651

}

Original file line number Diff line number Diff line change

@@ -992,10 +992,12 @@ int PyUpb_Message_SetFieldValue(PyObject* _self, const upb_FieldDef* field,

992 992

if (PyObject_HasAttrString(sub_message, "_internal_assign")) {

993 993

PyObject* ok =

994 994

PyObject_CallMethod(sub_message, "_internal_assign", "O", value);

995 +

Py_DECREF(sub_message);

995 996

if (!ok) return -1;

996 997

Py_DECREF(ok);

997 998

return 0;

998 999

}

1000 +

Py_DECREF(sub_message);

999 1001

}

1000 1002

PyErr_Format(exc,

1001 1003

"Assignment not allowed to message "

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4