Skip to content

Commit

Permalink
Snapshot regression
Browse files Browse the repository at this point in the history
Reverted changes to the `sip` module sources so that they build using MSVC.
  • Loading branch information
philthompson10 committed Dec 5, 2024
1 parent 93369f6 commit 0e02efe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions sipbuild/module/source/12/siplib.c
Original file line number Diff line number Diff line change
Expand Up @@ -7776,32 +7776,35 @@ static void sip_api_abstract_method(const char *classname, const char *method)
classname, method);
}


/*
* Report a deprecated class or method.
*/
int sip_api_deprecated(const char *classname, const char *method)
{
return sip_api_deprecated_12_16( classname, method, NULL );
return sip_api_deprecated_12_16(classname, method, NULL);
}


/*
* Report a deprecated class or method with a given message.
* Report a deprecated class or method with an optional message.
*/
int sip_api_deprecated_12_16(const char *classname, const char *method, const char *message)
int sip_api_deprecated_12_16(const char *classname, const char *method,
const char *message)
{
const unsigned int bufsize = 100 + ( message ? strlen(message) : 0 );
char buf[bufsize];
char buf[100];

if (classname == NULL)
PyOS_snprintf(buf, sizeof (buf), "%s() is deprecated", method);
else if (method == NULL)
PyOS_snprintf(buf, sizeof (buf), "%s constructor is deprecated",
classname);
else
PyOS_snprintf(buf, sizeof (buf), "%s.%s() is deprecated", classname, method);
PyOS_snprintf(buf, sizeof (buf), "%s.%s() is deprecated", classname,
method);

if (message != NULL)
PyOS_snprintf(&buf[strlen(buf)], sizeof (buf), ": %s", message);
PyOS_snprintf(&buf[strlen(buf)], sizeof (buf), ": %s", message);

return PyErr_WarnEx(PyExc_DeprecationWarning, buf, 1);
}
Expand Down
17 changes: 10 additions & 7 deletions sipbuild/module/source/13/sip_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -6661,32 +6661,35 @@ static void sip_api_abstract_method(const char *classname, const char *method)
classname, method);
}


/*
* Report a deprecated class or method.
*/
int sip_api_deprecated(const char *classname, const char *method)
{
return sip_api_deprecated_13_9( classname, method, NULL );
return sip_api_deprecated_13_9(classname, method, NULL);
}


/*
* Report a deprecated class or method with a given message.
* Report a deprecated class or method with an optional message.
*/
int sip_api_deprecated_13_9(const char *classname, const char *method, const char *message)
int sip_api_deprecated_13_9(const char *classname, const char *method,
const char *message)
{
const unsigned int bufsize = 100 + ( message ? strlen(message) : 0 );
char buf[bufsize];
char buf[100];

if (classname == NULL)
PyOS_snprintf(buf, sizeof (buf), "%s() is deprecated", method);
else if (method == NULL)
PyOS_snprintf(buf, sizeof (buf), "%s constructor is deprecated",
classname);
else
PyOS_snprintf(buf, sizeof (buf), "%s.%s() is deprecated", classname, method );
PyOS_snprintf(buf, sizeof (buf), "%s.%s() is deprecated", classname,
method );

if (message != NULL)
PyOS_snprintf(&buf[strlen(buf)], sizeof (buf), ": %s", message);
PyOS_snprintf(&buf[strlen(buf)], sizeof (buf), ": %s", message);

return PyErr_WarnEx(PyExc_DeprecationWarning, buf, 1);
}
Expand Down

0 comments on commit 0e02efe

Please sign in to comment.