(root)/
Python-3.11.7/
Modules/
clinic/
_datetimemodule.c.h
       1  /*[clinic input]
       2  preserve
       3  [clinic start generated code]*/
       4  
       5  PyDoc_STRVAR(datetime_date_fromtimestamp__doc__,
       6  "fromtimestamp($type, timestamp, /)\n"
       7  "--\n"
       8  "\n"
       9  "Create a date from a POSIX timestamp.\n"
      10  "\n"
      11  "The timestamp is a number, e.g. created via time.time(), that is interpreted\n"
      12  "as local time.");
      13  
      14  #define DATETIME_DATE_FROMTIMESTAMP_METHODDEF    \
      15      {"fromtimestamp", (PyCFunction)datetime_date_fromtimestamp, METH_O|METH_CLASS, datetime_date_fromtimestamp__doc__},
      16  
      17  static PyObject *
      18  iso_calendar_date_new_impl(PyTypeObject *type, int year, int week,
      19                             int weekday);
      20  
      21  static PyObject *
      22  iso_calendar_date_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
      23  {
      24      PyObject *return_value = NULL;
      25      static const char * const _keywords[] = {"year", "week", "weekday", NULL};
      26      static _PyArg_Parser _parser = {NULL, _keywords, "IsoCalendarDate", 0};
      27      PyObject *argsbuf[3];
      28      PyObject * const *fastargs;
      29      Py_ssize_t nargs = PyTuple_GET_SIZE(args);
      30      int year;
      31      int week;
      32      int weekday;
      33  
      34      fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 3, 3, 0, argsbuf);
      35      if (!fastargs) {
      36          goto exit;
      37      }
      38      year = _PyLong_AsInt(fastargs[0]);
      39      if (year == -1 && PyErr_Occurred()) {
      40          goto exit;
      41      }
      42      week = _PyLong_AsInt(fastargs[1]);
      43      if (week == -1 && PyErr_Occurred()) {
      44          goto exit;
      45      }
      46      weekday = _PyLong_AsInt(fastargs[2]);
      47      if (weekday == -1 && PyErr_Occurred()) {
      48          goto exit;
      49      }
      50      return_value = iso_calendar_date_new_impl(type, year, week, weekday);
      51  
      52  exit:
      53      return return_value;
      54  }
      55  
      56  PyDoc_STRVAR(datetime_datetime_now__doc__,
      57  "now($type, /, tz=None)\n"
      58  "--\n"
      59  "\n"
      60  "Returns new datetime object representing current time local to tz.\n"
      61  "\n"
      62  "  tz\n"
      63  "    Timezone object.\n"
      64  "\n"
      65  "If no tz is specified, uses local timezone.");
      66  
      67  #define DATETIME_DATETIME_NOW_METHODDEF    \
      68      {"now", _PyCFunction_CAST(datetime_datetime_now), METH_FASTCALL|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
      69  
      70  static PyObject *
      71  datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
      72  
      73  static PyObject *
      74  datetime_datetime_now(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      75  {
      76      PyObject *return_value = NULL;
      77      static const char * const _keywords[] = {"tz", NULL};
      78      static _PyArg_Parser _parser = {NULL, _keywords, "now", 0};
      79      PyObject *argsbuf[1];
      80      Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
      81      PyObject *tz = Py_None;
      82  
      83      args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
      84      if (!args) {
      85          goto exit;
      86      }
      87      if (!noptargs) {
      88          goto skip_optional_pos;
      89      }
      90      tz = args[0];
      91  skip_optional_pos:
      92      return_value = datetime_datetime_now_impl(type, tz);
      93  
      94  exit:
      95      return return_value;
      96  }
      97  /*[clinic end generated code: output=1a3da7479e443e17 input=a9049054013a1b77]*/