A RetroSearch Logo

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

Search Query:

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

Add Python deprecation warnings for Descriptor Label. · protocolbuffers/protobuf@64a76e6 · GitHub

@@ -1054,8 +1054,20 @@ static PyObject* PyUpb_FieldDescriptor_GetCppType(PyUpb_DescriptorBase* self,

1054 1054

return PyLong_FromLong(cpp_types[upb_FieldDef_CType(self->def)]);

1055 1055

}

1056 1056 1057 +

static void WarnDeprecatedLabel(void) {

1058 +

static int deprecated_label_count = 100;

1059 +

if (deprecated_label_count > 0) {

1060 +

--deprecated_label_count;

1061 +

PyErr_WarnEx(

1062 +

PyExc_DeprecationWarning,

1063 +

"label() is deprecated. Use is_required() or is_repeated() instead.",

1064 +

3);

1065 +

}

1066 +

}

1067 + 1057 1068

static PyObject* PyUpb_FieldDescriptor_GetLabel(PyUpb_DescriptorBase* self,

1058 1069

void* closure) {

1070 +

WarnDeprecatedLabel();

1059 1071

return PyLong_FromLong(upb_FieldDef_Label(self->def));

1060 1072

}

1061 1073

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