<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>On 09.01.2018 21:35, Ivan Pozdeev via Python-ideas wrote:<br>
    </p>
    <blockquote type="cite"
      cite="mid:10ff9787-8656-d973-3edd-6b13d1b6e659@mail.mipt.ru">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      On 08.01.2018 0:11, Steve Dower wrote:<br>
      <blockquote type="cite"
        cite="mid:20180107211111.B73001200A1@relay2.telecom.mipt.ru">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <meta name="Generator" content="Microsoft Word 15 (filtered
          medium)">
        <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
        <div class="WordSection1">
          <p class="MsoNormal"><span lang="EN-AU">It’s not a good idea.
              You end up with two different C runtimes in memory that
              cannot communicate, and many things will not work
              properly.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-AU">If you compile your
              debug build extension with the non-debug CRT (/MD rather
              than /MDd) you will lose asserts, but otherwise it will
              work fine and the quoted code picks the release lib.<o:p></o:p></span></p>
        </div>
      </blockquote>
      Distutils' designers seem to have thought differently.<br>
      Whether the extension is linked against pythonxx_d.lib is governed
      by the --debug switch to the `build' command rather than the type
      of the running Python. Compiler optimization flags and /MD(d) are
      inserted according to it, too.<br>
      <br>
      As a consequence,<br>
      * I cannot install an extension into debug Python at all 'cuz
      `bdist_*' and `install' commands don't support --debug and invoke
      `debug' internally without it.<br>
    </blockquote>
    I meant "invoke `build' internally without it." , sorry.<br>
    <br>
    This kafkaesque "you cannot do this because you cannot do this" is
    taking its toll on me...<br>
    <blockquote type="cite"
      cite="mid:10ff9787-8656-d973-3edd-6b13d1b6e659@mail.mipt.ru"> *
      Neither can I compile an extension for release Python without
      optimizations.<br>
      <br>
      I'm at a loss here. Either I'm missing something, or with the
      current build system, it's impossible to debug extensions!<br>
      <blockquote type="cite"
        cite="mid:20180107211111.B73001200A1@relay2.telecom.mipt.ru">
        <div class="WordSection1">
          <p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-AU">Or if you like, when
              you install Python 3.5 or later there are advanced options
              to install debug symbols and binaries. You can use a
              proper debug build against the debug binaries
              (python_d.exe).<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-AU"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-AU">Cheers,<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-AU">Steve</span></p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">Top-posted from my Windows phone</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div
            style="mso-element:para-border-div;border:none;border-top:solid
            #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal" style="border:none;padding:0in"><b>From:
              </b><a href="mailto:python-ideas@python.org"
                moz-do-not-send="true">Ivan Pozdeev via Python-ideas</a><br>
              <b>Sent: </b>Saturday, December 30, 2017 13:01<br>
              <b>To: </b><a href="mailto:python-ideas@python.org"
                moz-do-not-send="true">python-ideas@python.org</a><br>
              <b>Subject: </b>[Python-ideas] Allow to compile debug
              extension against releasePython in Windows</p>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">The Windows version of pyconfig.h has the
            following construct:</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">     if defined(_DEBUG)</p>
          <p class="MsoNormal">            pragma
            comment(lib,"python37_d.lib")</p>
          <p class="MsoNormal">     elif defined(Py_LIMITED_API)</p>
          <p class="MsoNormal">            pragma
            comment(lib,"python3.lib")</p>
          <p class="MsoNormal">     else</p>
          <p class="MsoNormal">            pragma
            comment(lib,"python37.lib")</p>
          <p class="MsoNormal">     endif /* _DEBUG */</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">which fails the compilation of a debug
            version of an extension. Making </p>
          <p class="MsoNormal">debugging it... difficult.</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">Perhaps we could define some other
            constant?</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">I'm not sure whether such compilation is
            a good idea in general, so </p>
          <p class="MsoNormal">asking here at first.</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">-- </p>
          <p class="MsoNormal">Regards,</p>
          <p class="MsoNormal">Ivan</p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">_______________________________________________</p>
          <p class="MsoNormal">Python-ideas mailing list</p>
          <p class="MsoNormal"><a class="moz-txt-link-abbreviated"
              href="mailto:Python-ideas@python.org"
              moz-do-not-send="true">Python-ideas@python.org</a></p>
          <p class="MsoNormal"><a class="moz-txt-link-freetext"
              href="https://mail.python.org/mailman/listinfo/python-ideas"
              moz-do-not-send="true">https://mail.python.org/mailman/listinfo/python-ideas</a></p>
          <p class="MsoNormal">Code of Conduct: <a
              class="moz-txt-link-freetext"
              href="http://python.org/psf/codeofconduct/"
              moz-do-not-send="true">http://python.org/psf/codeofconduct/</a></p>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Regards,
Ivan</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Python-ideas mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-ideas@python.org">Python-ideas@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a>
Code of Conduct: <a class="moz-txt-link-freetext" href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Regards,
Ivan</pre>
  </body>
</html>